C++高级语言程序设计第8篇.pptVIP

  • 2
  • 0
  • 约1.62万字
  • 约 64页
  • 2017-06-17 发布于湖北
  • 举报
* int main(){ TCircle c(1,2,3); coutTCircle c\t; c.Show(); coutendl; ? //TShape* ps = c; TShape* ps = dynamic_castTShape*(c); //基类对象指针指向 //派生类对象 if(0!=ps) { coutps=c\t\t; ps-Show(); coutendl; } return 0; } //Main09.cpp //本文件的代码除了main()函数之外,均与Main08.cpp相同 #include iostream using namespace std; class TShape { protected: int x, y; public: TShape(int mx=0, int my=0) { x=mx; y=my; } void Show() {coutx=x\t y=y;} }; class TCircle : public TShape { protected: int r; public: TCirc

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档