Facebook
From Round Coyote, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 264
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class MalyObiekt1
  6. {
  7.  
  8. public:
  9.     MalyObiekt1() {cout<<"mo1_kd"<<endl;}
  10.     ~MalyObiekt1() {cout<<"mo1_d"<<endl;}
  11. };
  12.  
  13. class Obiekt{
  14.  
  15. public:
  16.     Obiekt() {cout<<"kd"<<endl;}
  17.     obiekt(const Obiekt &kk) {cout<<"kk"<<endl;}
  18.  
  19.     bool operator==(Obiekt o)
  20.     {
  21.         cout<<"o=="<<endl; return false;
  22.     }
  23.  
  24.     Obiekt operator=(Obiekt &o)
  25.     {
  26.         cout<<"op"<<endl; return *this;
  27.     }
  28.  
  29.     MalyObiekt1 funkcja()
  30.     {
  31.         cout<<"f"<<endl;
  32.         MalyObiekt1 o2;
  33.         return o2;
  34.     }
  35.  
  36.     ~Obiekt()
  37.     {
  38.         cout<<"des"<<endl;
  39.     }
  40.  
  41. private:
  42. };
  43.  
  44. int main()
  45. {
  46.     Obiekt o1, o2;
  47.     MalyObiekt1 mo;
  48.     bool wynik;
  49.      wynik = (o1==o2);
  50.     mo = o1.funkcja();
  51.     return 0;
  52. }
  53.