So, I got a code like this:
class Fruit
{//some constructor method and instance in here}
class Banana: public Fruit
{//some constructor method and instance in here}
class plant
{
public:
plant(){
thisFruit->Banana();//everytime a new plant is created, its thisFruit will point to a new Banana Object
}
private:
Fruit *thisFruit;//this plant has a pointer to a fruit
}
however, I got an error in the "this-Fruit->banana();" that state "pointer to incomplete class type is not allowed. is there something wrong with my code? thx
->
does. Even though it looks like an arrow, that does not mean that it makes stuff point to other stuff.->
operator does here.