ここで、コードなしで説明するのが難しいことを正確に示します。
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);
}
私はオブジェクト クラス ポインターしか持っておらず、属性クラスから継承するのが文字オブジェクトなのか別のオブジェクトなのかわかりません。クラスが属性クラスから継承されていることはわかっています。