This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Last revision Both sides next revision | ||
java:class_constructors [2017/02/16 11:04] gthanos [Κατασκευαστές της κλάσης] |
java:class_constructors [2017/03/01 15:33] gthanos [Πολλαπλοί κατασκευαστές σε μία κλάση] |
||
---|---|---|---|
Line 56: | Line 56: | ||
public Rectangle(int initWidth, int initHeight, Point initOrigin); | public Rectangle(int initWidth, int initHeight, Point initOrigin); | ||
public Rectangle(int initWidth, int initHeight, int xPos, int yPos); | public Rectangle(int initWidth, int initHeight, int xPos, int yPos); | ||
+ | public Rectangle(int initWidth, int initHeight); | ||
</code> | </code> | ||
Line 78: | Line 79: | ||
height = initHeight; | height = initHeight; | ||
origin = new Point(xPos,yPos); | origin = new Point(xPos,yPos); | ||
+ | } | ||
+ | | ||
+ | public Rectangle(int initWidth, int initHeight) { | ||
+ | width = initWidth; | ||
+ | height = initHeight; | ||
+ | origin = null; | ||
} | } | ||
| |