±Û¾´ÀÌ :ÀÌ¿¬È£ 1998³â 3¿ù 03ÀÏ 19:21:50
¾Æ·¡ÀÇ Äڵ尡 PolymorphismÀ» ¼³¸íÇÏ´ÂÁö ºÁ ÁÖ¼¼¿ä.
¾Æ·¡ÀÇ Äڵ尡 ¼³¸íÇÏ·Á´Â °ÍÀº ¹¹ÁÒ?
±×¸®°í PolymorphismÀº ¿Ö/¾ðÁ¦ ÇÊ¿äÇÏÁÒ?
´©°¡ ÀÚ¼¼È÷ ¼³¸íÇØÁֽǺР¾ø³ª¿ä????
class Parent {
String name = "Parent";
public void thisFunction() {
System.out.println( this.name );
}
}
class Child extends Parent {
String name = "Child";
public void thisFunction() {
System.out.println( this.name );
}
}
class SuperThis {
public static void main( String args[] ) {
Parent polymorphism = new Child();
polymorphism.thisFunction();
polymorphism = new Parent();
polymorphism.thisFunction();
}
}