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 revisionBoth sides next revision
cpp:copy_constructors [2021/05/07 08:03] – [Μια πιο σύνθετη περίπτωση] gthanoscpp:copy_constructors [2021/05/07 08:32] – [Μια πιο σύνθετη περίπτωση] gthanos
Line 200: Line 200:
     void setX(int vx) { x = vx; }     void setX(int vx) { x = vx; }
     void setY(int vy) { y = vy; }     void setY(int vy) { y = vy; }
-    int getX() { return x; } +    int getX() const { return x; } 
-    int getY() { return y; }+    int getY() const { return y; }
 }; };
 </code> </code>
Line 296: Line 296:
 Ο προτεινόμενος κατασκευαστής αντιγραφέας δίνεται παρακάτω: Ο προτεινόμενος κατασκευαστής αντιγραφέας δίνεται παρακάτω:
 <code cpp> <code cpp>
-Rectangle::Rectangle(Rectangle &r) {+Rectangle::Rectangle(const Rectangle &r) {
   width = r.width;   width = r.width;
   height = r.height;   height = r.height;
cpp/copy_constructors.txt · Last modified: 2022/05/12 19:41 by gthanos