阅读背景:

无法从类型基类的指针访问派生类方法

来源:互联网 

I should specify that I'm a bit new to OOP. I'm tying to make a vector of type pointer to Person that has a method GetName() and access a method GetSpg() from my Player class that derives Person. I get an error "GetSpg() is not a member of Person". My question would be: is there any way to access both functions from the vector so that if it points to a Person to not show that method but if it is to do so?I should specify that I'm a bit new to OOP. I'm




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: