Advertisement
genets

Untitled

Jun 25th, 2019
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Time1
  5. {
  6.     public:
  7.         Time1();
  8.         Time1(int h, int m, int s);
  9.         virtual ~Time1();
  10.  
  11.     protected:
  12.         int H, M, S;
  13.     private:
  14. };
  15.  
  16. Time1::Time1()
  17. {
  18.     H = 15;
  19.     M = 44;
  20.     S = 10;
  21.  
  22.     cout << "Вызов конструктора для объекта " << this << endl;
  23. }
  24.  
  25. Time1::Time1(int h, int m, int s)
  26. {
  27.     H = h;
  28.     M = m;
  29.     S = s;
  30.  
  31.     cout << "Вызов конструктора для объекта " << this << endl;
  32. }
  33.  
  34. Time1::~Time1()
  35. {
  36.     cout << "Вызов деструктора для объекта " << this << endl;
  37. }
  38.  
  39. int main()
  40. {
  41.     setlocale(LC_ALL, "rus");
  42.  
  43.     cout << "Nikita"<<endl;
  44.  
  45.     Time1 time1(12, 20, 45);
  46.     Time1 time2;
  47.  
  48.     return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement