这里向你展示我的意思究竟是很难形容毫不代码:如何从另一个继承类的继承类的说话
class Object
{
// attributes..
};
class Attribute
{
public:
void myfunc();
};
class Character: public Object, public Attribute
{
};
void main()
{
Object* ch = new Character;
// How can I call the myfunc() from Attribute
// tried static_cast<Attribute*>(ch);
}
我才刚刚有一个对象类指针,我不知道 如果它是一个字符对象或从属性类继承的另一个对象,我知道的是该类继承自属性类。