- 3
- 0
- 约1.95万字
- 约 57页
- 2017-01-02 发布于北京
- 举报
第四章继承和派生 4.1继承和派生的概念 //Column.cpp #include Column.h #include iostream using namespace std; void Column::Show() { Circle::Show(); cout高为:hendl; } float Column::GetArea() { return 2*Circle::GetArea()+GetLength()*h; } float Column::GetVolume() { return Circle::GetArea()*h; } Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. 在多层派生的情况下:派生类的构造函数初始化列表中只须写出其上一层派生类的构造函数,不要再写上其间接子类的构造函数。 Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. 4.5.4 派生类的析构函数 在派生时,派生类是不能继承基类
原创力文档

文档评论(0)