Tag: 指针分类

派生类和基类之间指针指针的转换?

关于下面的C ++程序: class Base { }; class Child : public Base { }; int main() { // Normal: using child as base is allowed Child *c = new Child(); Base *b = c; // Double pointers: apparently can't use Child** as Base** Child **cc = &c; Base **bb = cc; return 0; } GCC在最后的赋值语句上产生以下错误: error: […]