1 | Methods of identical name to class are special -- they are constructors |
2 |
mPoint() { /* Default Constructor */
|
3 | } |
4 | We can overload method to define different versions with different numbers and types of arguments |
5 |
mPoint(int x, int y) { /* Constructor to set Specific Initial values */
|
6 | } |
7 | Note this refers to current object |
8 | mPoint can have other methods to set its instance variables such as: |
9 |
public void setDelta(int _dx, int _dy) {
|
10 | } /* where we don't need this as used _dx, _dy */ |