User Tools

Site Tools


cpp:copy_constructors

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
cpp:copy_constructors [2021/05/07 08:35] – [Μια πιο σύνθετη περίπτωση] gthanoscpp:copy_constructors [2022/05/12 18:56] gthanos
Line 23: Line 23:
     int getHeight();     int getHeight();
 }; };
 +</code>
 +
 +<code cpp Rectangle.cpp>
 +#include "Rectangle.hpp"
  
 Rectangle::Rectangle(int w, int h) { Rectangle::Rectangle(int w, int h) {
Line 29: Line 33:
 } }
  
-Rectangle::Rectangle(int s) {+Rectangle::Rectangle(int s) {
   cout << "Calling 1 args constructor" << endl;   cout << "Calling 1 args constructor" << endl;
   width = s; height = s;   width = s; height = s;
Line 99: Line 103:
     Rectangle(int s);     Rectangle(int s);
     Rectangle();     Rectangle();
-    Rectangle(Rectangle& r);+    Rectangle(const Rectangle& r);
     void setWidth(int w);     void setWidth(int w);
     void setHeight(int h);     void setHeight(int h);
cpp/copy_constructors.txt · Last modified: 2022/05/12 19:41 by gthanos