Advertisement
dllbridge

Untitled

Apr 22nd, 2024
729
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.38 KB | None | 0 0
  1.  
  2.  
  3.  
  4. #include  <iostream>
  5. using namespace std;
  6.  
  7.  
  8. char *psz = setlocale(LC_ALL, "rus");
  9.  
  10.  
  11. //////////////////////////////////////////////////////////
  12. class Cfigure
  13. {
  14.    
  15.       public:
  16.            
  17.       Cfigure()
  18.       {
  19.            
  20.          cout << "Конструктор Cfigure \n";      
  21.       }        
  22.            
  23.    
  24.      virtual
  25.       void draw()
  26.       {
  27.            
  28.            cout << "Рисую... \n"; 
  29.       }
  30.    
  31. }Cf;
  32.  
  33.  
  34.  
  35. //////////////////////////////////////////////////////////
  36. class Ccircle : public Cfigure
  37. {
  38.       public:
  39.            
  40.            
  41.       Ccircle()
  42.       {
  43.            
  44.          cout << "Конструктор Ccircle \n";      
  45.       }            
  46.    
  47.       void draw()
  48.       {
  49.            
  50.            cout << "круг \n";  
  51.       }
  52.    
  53. } Cc;
  54.  
  55.  
  56. //////////////////////////////////////////////////////////
  57. class Csquare : public Cfigure
  58. {
  59.       public:
  60.    
  61.       void draw()
  62.       {
  63.            
  64.            cout << "квадрат \n";
  65.       }
  66.    
  67. } Csq;
  68.  
  69.  
  70.  
  71.  
  72. //////////////////////////////////////////////////////////
  73. class Ctriangle : public Cfigure
  74. {
  75.       public:
  76.    
  77.       void draw()
  78.       {
  79.            
  80.            cout << "треугольник \n";
  81.       }
  82.    
  83. } Ctr;
  84.  
  85.  
  86.  
  87. ///////////////////////////////////////////////////////////
  88. int main()
  89. {
  90.  //   setlocale(LC_ALL, "rus");
  91.    
  92.    
  93. //  cout << psz << endl;
  94.    
  95.     Cf .draw();
  96.     Cc .draw();
  97.     Csq.draw();
  98.     Ctr.draw();
  99.    
  100.     Cfigure *pCarr[9] = {&Cf, &Cc, &Csq, &Ctr};
  101.    
  102.     for(int i = 0; i < 4; i++)
  103.     {
  104.        
  105.         pCarr[i] -> draw();
  106.     }
  107. }
  108.  
  109.  
  110.  
  111.  
  112.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement