กระดานแสดงความคิดเห็น
Home
Contents
Articles
Quiz
Members
Sponsor
Print-friendly
MENU
ปรับปรุง : 2566-10-15 (กระดานแสดงความคิดเห็น)
เว็บเพจหน้านี้สำหรับผู้ดูแลเท่านั้น
รหัส secure
=>
นำตัวอักษร สีขาวบนพื้นแดง มาป้อนในช่องนี้
edit_topic_password =>
<center><table width=90% border=0 bgcolor=#000080><tr><td><font color=white size=4>ตัวอย่าง polymorphism แบบ dynamic binding จาก 3 class</td></tr></table><table width=90% bordercolor=#000080 border=1><tr><td bgcolor=white><br>class mother {<br /> public String home() { String x = "old"; return x;}<br /> }<br /> // ==================<br /> class child extends mother {<br /> public String home() { String x = "new"; return x;}<br /> }<br /> // ==================<br /> class work{<br /> public static void main (String args[]) {<br /> mother x = new child();<br /> System.out.print(x.home()); // new<br /> }<br /> }<br /> // Dynamic Binding of method is polymorphism<br /> // if home is static will use home() in mother<br /> // compile will check in mother<br /> // run will check in child so output is new<br /> // no problem is not override in child<br /> // study from ajarn Passakorn Pruekpitakkul<br><br></td></tr><tr><td align=right bgcolor=black><font color=white><small><b>จากคุณ :</b> บุรินทร์ <a href=mailto:></a><a title='61.7.146.89'>.</a><br> 02:46am (15/07/07)</font></td></tr></table></center>