所以,我得到了这样的代码:
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
}
但是,我在“this-Fruit->banana();”中遇到错误 该状态“不允许指向不完整的类类型。我的代码有问题吗?谢谢