User Tools

Site Tools


cpp:classes

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:classes [2017/05/10 04:36] – [Οι μέθοδοι της κλάσης] gthanoscpp:classes [2020/04/08 07:35] gthanos
Line 13: Line 13:
     void setWidth(int w);     void setWidth(int w);
     void setHeight(int h);     void setHeight(int h);
-    int getWidth(); +    int getWidth() const
-    int getHeight();+    int getHeight() const;
 }; };
  
 void Rectangle::setWidth(int w) { width = w; } void Rectangle::setWidth(int w) { width = w; }
 void Rectangle::setHeight(int h) { height = h; } void Rectangle::setHeight(int h) { height = h; }
-int Rectangle::getWidth() { return width; } +int Rectangle::getWidth() const { return width; } 
-int Rectangle::getHeight() { return height; }+int Rectangle::getHeight() const { return height; }
  
 int main () { int main () {
cpp/classes.txt · Last modified: 2021/05/06 23:01 (external edit)