相关代码 |
|
/* 程序11.4:基类和派生类.cpp:*/ #include using namespace std; class Furniture { int width; int height; public: void Accept() { cout cin>>width; cout cin>>height; } void Display() { cout cout } }; class Chair:public Furniture { int no_legs; public: void Accept() { Furniture::Accept(); cout cin>>no_legs; } void Display() { Furniture::Display(); cout } }; int main() { Chair chairobj; chairobj.Accept(); chairobj.Display(); return 0; }
相关资源 |
|