第11章 水类间的关系的实现.pptVIP

  • 1
  • 0
  • 约2.53千字
  • 约 35页
  • 2021-12-06 发布于福建
  • 举报
class CDerived : public CBase1, public CBase2 { public: int b; CDerived() { b=0x21; } }; void main() { CDerived obj; } ;11.1.2 赋值兼容规则;11.1.3 两义性与作用域分辨;11.1.3 两义性与作用域分辨;11.1.3 两义性与作用域分辨;11.1.3 两义性与作用域分辨;11.2 多态性与虚函数;11.2.1 编译时刻的多态性;11.2.2 运行时刻的多态性;class CCircle : public CPoint { private: float m_nRadius; public: CCircle(int x=0, int y=0, float r=0) : CPoint(x, y) { m_nRadius=r; } void SetRadius(float r) { m_nRadius=r; } void Area() { coutHere is a circles area: PI*m_nRadius*m_nRadiusendl; } }; void main() { CPoint *p; CCircle c(0, 0, 2); p=c; p-Area(); };11.2.3 虚

文档评论(0)

1亿VIP精品文档

相关文档