#include<iostream>
using namespace std;
class Rectangle
{
// 派生类声明
// class ColorRectangle:publicRectangle
class ColorRectangle:privateRectangle
{
void main()
{
using namespace std;
class Rectangle
{
private:
intwidth;intheight;
public:
};voidInitRect(int w = 0, int h = 0){width = w;height = h;}intGetWidth(){ return width; }intGetHeight(){return height;}
// 派生类声明
// class ColorRectangle:publicRectangle
class ColorRectangle:privateRectangle
{
private:
intcolor;
public:
};voidInitColorRect(int w = 0, int h = 0, int c = 0){InitRect(w, h);color = c;}// Not ColorRectangle::GetWidth();intGetWidth(){ returnRectangle::GetWidth(); }
// Not ColorRectangle::GetHeight();intGetHeight(){returnRectangle::GetHeight();}
intGetColor(){ return color; }
void main()
{
ColorRectangle crt;// crt: color-rectangle}
crt.InitColorRect(3, 5, 8);
cout << "Width\t= " << crt.GetWidth() << endl;
cout << "Height\t= " << crt.GetHeight() << endl;
cout << "Color\t= " << crt.GetColor() << endl;