Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- char *psz = setlocale(LC_ALL, "rus");
- //////////////////////////////////////////////////////////
- class Cfigure
- {
- public:
- Cfigure()
- {
- cout << "Конструктор Cfigure \n";
- }
- virtual
- void draw()
- {
- cout << "Рисую... \n";
- }
- }Cf;
- //////////////////////////////////////////////////////////
- class Ccircle : public Cfigure
- {
- public:
- Ccircle()
- {
- cout << "Конструктор Ccircle \n";
- }
- void draw()
- {
- cout << "круг \n";
- }
- } Cc;
- //////////////////////////////////////////////////////////
- class Csquare : public Cfigure
- {
- public:
- void draw()
- {
- cout << "квадрат \n";
- }
- } Csq;
- //////////////////////////////////////////////////////////
- class Ctriangle : public Cfigure
- {
- public:
- void draw()
- {
- cout << "треугольник \n";
- }
- } Ctr;
- ///////////////////////////////////////////////////////////
- int main()
- {
- // setlocale(LC_ALL, "rus");
- // cout << psz << endl;
- Cf .draw();
- Cc .draw();
- Csq.draw();
- Ctr.draw();
- Cfigure *pCarr[9] = {&Cf, &Cc, &Csq, &Ctr};
- for(int i = 0; i < 4; i++)
- {
- pCarr[i] -> draw();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement