hi, here is my problem
Iam aware that a derived class is capable of not only using a constructor to initialise its own attributes but it is also able to send values to the base class constructor it has inherited from.
However what happens when a class (eg. animal) inherits from a base class (eg. organism) and then another class (eg.dolphin) inherits from the animal class?
When creating a dolphin its constructor needs to give values to its own attributes (dolphin), the animals attributes and also to the base class organism.
ORGANISM
ANIMAL
DOLPHIN
I know how to send attributes to the class immeadiately above it in the class hierachy, but i dont know how to use the constructor to send values to the class above that.
//example of constructors
oraganism:
rganism (int a, b)
animal::animal(int a, int b, int c)
rganism(a,b) //this i understand
dolphin::dolphin(int d,int e,int f,int g):animal(d,e) //and this
but how to send values from dolphin to both animal and organism???
could i put this on the end of the dolphin constructor the following? " : animal (d, e) : organism ( g ) "
hope its not to long winded... plz help or ask questions... cheers!
maybe its my design???
Iam aware that a derived class is capable of not only using a constructor to initialise its own attributes but it is also able to send values to the base class constructor it has inherited from.
However what happens when a class (eg. animal) inherits from a base class (eg. organism) and then another class (eg.dolphin) inherits from the animal class?
When creating a dolphin its constructor needs to give values to its own attributes (dolphin), the animals attributes and also to the base class organism.
ORGANISM
ANIMAL
DOLPHIN
I know how to send attributes to the class immeadiately above it in the class hierachy, but i dont know how to use the constructor to send values to the class above that.
//example of constructors
oraganism:
animal::animal(int a, int b, int c)
dolphin::dolphin(int d,int e,int f,int g):animal(d,e) //and this
but how to send values from dolphin to both animal and organism???
could i put this on the end of the dolphin constructor the following? " : animal (d, e) : organism ( g ) "
hope its not to long winded... plz help or ask questions... cheers!
maybe its my design???