fork download
  1. #include <iostream>
  2. using namespace std;
  3. class Tacka
  4. {private:
  5. int x; int y;
  6. public:
  7. Tacka():x(0),y(0){ cout<<"konstruktor bez argumenata"<<endl;}
  8. Tacka(int a, int b){ x = a; y = b; cout<<"konstruktor"<<endl;}
  9. ~Tacka(){ cout<<"destruktor"<<endl; }
  10. int GetX()const{ return x; }
  11. int GetY()const{ return y; }
  12. };
  13. int main(){
  14. Tacka *t1 = new Tacka(2,5);
  15. cout<<"x="<<t1->GetX()<<"; y="<<t1->GetY()<<endl;
  16. delete t1;
  17. cin.get();
  18. return 0;
  19. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
konstruktor
x=2; y=5
destruktor