www.un.org/spanish/ecosoc Edit Solved和Reposted作为样本方案
设想情况如下:
等级等级:
class Base
{
public:
virtual void output() = 0;
private:
int a;
};
class Derived_1 : public Base
{
public:
virtual void output()
{
cout << "Derived_1" << endl;
}
};
class Derived_2 : public Derived_1
{
public:
virtual void output()
{
cout << "Derived_2" << endl;
}
};
执行:
Derived_2* obj = reinterpret_cast<Derived_2*>(new Derived_1());
obj->output();
这将产生“依赖1”而不是“依赖2”。 我相信,这对你们大多数人来说并不陌生,但在我提出申请时,我并没有想到我的一些工厂职能。