我把一些密码带往Windows,并 st。 某些法典在发射时自动生效,以复制点人到点人,如果点人没有被撤销,则会再次退出点人。
我已经建立了一个样本方案,复制行为。
int main()
{
// Pointer to a Pointer, current crash.
InterfaceClass** ptrptr;
ConcreteTwo* object = new ConcreteTwo();
ptrptr = (InterfaceClass**)(&object); // cast is required for some reason.
delete *ptrptr; // Crash here.
// Single pointer, works fine.
InterfaceClass* ptrptr;
ConcreteTwo* object = new ConcreteTwo();
ptrptr = object;
delete ptrptr;
// There are other cases where there are only 3 classes in the hierarchy.
// This also works fine.
InterfaceClass** ptrptr;
ConcreteOne* object = new ConcreteOne();
ptrptr = (InterfaceClass**)(&object);
delete *ptrptr;
return 0;
}
等级为Hierarchy。 基础课程是某种纯虚拟功能的接口,许多课程都包含在课程中,因此许多物体可能从一个以上地点继承。 由于这一具体实施,必须将其扩大到“公共虚拟界面”。 在这一例子中,“虚拟”解决了坠毁问题。
class InterfaceClass {
public:
virtual ~InterfaceClass() {};
InterfaceClass() {}
};
class ConcreteClass : public virtual InterfaceClass {
public:
ConcreteClass() { }
virtual ~ConcreteClass() {}
};
class ConcreteOne : public ConcreteClass
{
public:
ConcreteOne(void) {}
virtual ~ConcreteOne(void) {}
};
class ConcreteTwo : public ConcreteOne
{
public:
ConcreteTwo(void) {}
virtual ~ConcreteTwo(void) {}
};