U E D R , A S I H C RSS

Java Study2004/오버로딩과오버라이딩

2004 간고 3

고, 구 (Overriding). 기 , 고, .
People move(int aX, int aY){this.position.x += aX;this.position.y += aY;} . 그고 People Student . 근 '' . 그 move . move(int aX, int aY){this.position.x -= aX;this.position.y -= aY;}
~cpp 
People people;//(100, 100)
people.move(10,10);//  (110, 110)

Student student;//(100, 100)
student.move(10,10);//  (90, 90)
. , , .

.
People move . move . people.move(1.1, 2.13) . move Overloading. move(double aX, double aY){this.position.x += (int)aX;this.position.y += (int)aY;} . . .
~cpp 
People people;//(100, 100)
people.move(10,10);//  (110, 110)
people.move(5.1,11.8);//Overloading  ,   (115, 121)

Overriding과 Overloading 겼기 . Overloading ' ', '과' 고, Overriding '', ''. .

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:23:32
Processing time 0.0129 sec