class subscriber
{
public:
virtual void update() = 0;
}
class entity : public subsriber
{
public:
virtual void update() = 0;
}
class myObject : public entity
{
public:
virtual void update()
{
do_things();
}
}
subscriber * ptr = new myObject; //will use shared_ptr, but here i want simplicity
ptr->update();
问题是,会调用正确的更新函数(在 myObject 中实现的那个)吗?在一个“家族”中拥有两个同名的纯虚函数是否有效?