fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct STR
  5. {
  6. STR() { cout<<"konstruktor domyslny"<<endl; }
  7. STR(const STR &S) { cout<<"konstruktor kopiujacy (radosnie kopiujemy cala zawartosc)"<<endl; }
  8. ~STR() { cout<<"destruktor"<<endl; }
  9. };
  10.  
  11. void f1(const STR & s) {}
  12. void f2(STR s) {}
  13.  
  14. int main()
  15. {
  16. STR S;
  17. cout<<"F1"<<endl;
  18. f1(S);
  19. cout<<"F2"<<endl;
  20. f2(S);
  21. cout<<"end"<<endl;
  22. return 0;
  23. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
konstruktor domyslny
F1
F2
konstruktor kopiujacy (radosnie kopiujemy cala zawartosc)
destruktor
end
destruktor