Microsoft Visual C++ MFC. Win95 WinNT




- 2


#include <iostream.h>

// Figure

class Figure

{

public:

//

virtual void PrintName(void)

{cout << Figure PrintName << \n};

//

void PrintDimention(void)

{cout << Figure PrintDimention << \n};

};

// Rectangle

class Rectangle : public Figure

{

//

virtual void PrintName(void)

{cout << Rectangle PrintName << \n};

//

void PrintDimention(void);

{cout << Rectangle PrintDimention << \n};

};

//

void main(void)

{

//

Rectangle rectObject;

//

//

*Rectangle ptrRectObject = &rectObject;

// Figure

// .

*Figure ptrFigObject = &rectObject;

// Rectangle,

rectObject.PrintName;

rectObject.PrintDimention;

cout << \n;

// Figure

rectObject.Figure::PrintName;

rectObject.Figure::PrintDimention;

cout << \n;

// Rectangle,

// Rectangle

ptrRectObject->PrintName;

ptrRectObject->PrintDimention;

cout << \n;

// Rectangle,

// Figure

ptrFigObject->PrintName;

ptrFigObject->PrintDimention;

}

, :

Rectangle PrintName

Rectangle PrintDimention

Figure PrintName

Figure PrintDimention

Rectangle PrintName

Rectangle PrintDimention

Figure PrintName

Figure PrintDimention