单选题

关于下面代码,说法错误的是( )

A

语句 Shape* shapePtr = &circle; 和 shapePtr =&rectangle; 出现编译错误

B

Shape 为基类, Circle 和 Rectangle 是派生类

C

通过继承, Circle 和 Rectangle 复用了 Shape 的属性和方法,并扩展了新的功能

D

Circle 和 Rectangle 通过重写(override)基类的虚函数 area 和基类指针,实现了运行时多态

赣ICP备20007335号-2