Thanks for looking over this snipit of code I can't figure this out, on line ten is the constructor for the Fish class and it takes a bool as a parameter, my question is what the second half of the constructor is after the ":". Yet again thanks for the help.
To access the function of the base class use this BaseClass::Function(), like so:
1 2 3 4 5 6 7 8 9 10 11
class Tuna: public Fish
{
public:
Tuna(): Fish(false) {}
void Swim()
{
std::cout << "Tuna swims real fast" << std::endl;
Fish::Swim(); // Note: this will show the message from the base class
}
};
Thanks, I'm still not understanding completely even after reading that article,
: FreshWaterFish(IsFreshWater){} still trounces me in my endeavors I just don't understand what it does because when I "//" that second half of line ten it still will compile and run the code just the same....any help?
: FreshWaterFish(IsFreshWater){}
-> it sets FreshWaterFish to the value of IsFreshWater
if you comment out the initialization FreshWaterFish has an undefined value.
It's just not predictable what the value of FreshWaterFish has, but otherwise there are no problems