Guest User

Untitled

a guest
Mar 6th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. //Az övé:
  2. Line::Line(const Line &obj) {
  3.    cout << "Copy constructor allocating ptr." << endl;
  4.    ptr = new int;
  5.    *ptr = *obj.ptr; // copy the value
  6. }
  7.  
  8. Line::~Line(void) {
  9.    cout << "Freeing memory!" << endl;
  10.    delete ptr;
  11. }
  12.  
  13. //Az enyém:
  14.  
  15. /// Másoló konstruktor
  16. Vektor::Vektor(const Vektor& v1) {
  17.     pVec = new double;
  18.     *pVec = *v1.pVec;
  19. }
  20.  
  21. /// Destruktor
  22. Vektor::~Vektor(){
  23.     delete[] pVec;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment