Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:关于继承的深入讨论 [Re:jameszhang]
ccikk





发贴: 2
积分: 0
于 2005-08-31 10:53 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
core java 的polymorphism描述中,明确说了,java的继承中,对象方法调用是late binding:object-oriented languages use the concept of late binding. When you send a message to an object, the code being called isn’t determined until run time. The compiler does ensure that the method exists and performs type checking on the arguments and return value (a language in which this isn’t true is called weakly typed), but it doesn’t know the exact code to execute

还举了例子:
void doStuff(Shape s) {
s.erase();
// ...
s.draw();
}

Circle c = new Circle();
Triangle t = new Triangle();
Line l = new Line();
doStuffCoffee;
doStuffPhone;
doStuff(l);

而对class的成员变量,则使用early binding。只会根据变量的类型,来获取成员变量的值。
所以楼主的问题就很明确了。




话题树型展开
人气 标题 作者 字数 发贴时间
15765 关于继承的深入讨论 jameszhang 402 2005-08-11 19:24
14198 Re:关于继承的深入讨论 truthawp 54 2005-08-11 23:22
14074 Re:关于继承的深入讨论 jameszhang 26 2005-08-20 10:09
14016 Re:关于继承的深入讨论 jameszhang 178 2005-08-28 14:29
13981 加精 ww1ww1 30 2005-08-28 23:13
14212 Re:关于继承的深入讨论 hxz5830 304 2005-08-29 15:03
13940 Re:关于继承的深入讨论 ww1ww1 369 2005-08-29 23:02
13947 Re:关于继承的深入讨论 jameszhang 48 2005-08-29 21:21
13991 Re:关于继承的深入讨论 ccikk 692 2005-08-31 10:53
13837 Re:关于继承的深入讨论 ccikk 552 2005-08-31 11:14
16437 Re:关于继承的深入讨论 zcjl 58 2005-09-05 21:14
14606 Re:关于继承的深入讨论 hxz5830 127 2005-08-15 18:38
14264 Re:关于继承的深入讨论 ww1ww1 11 2005-08-15 20:35
14229 Re:关于继承的深入讨论 jigsaw 13 2005-08-15 22:12
14325 Re:关于继承的深入讨论 whyuaou 128 2005-08-16 09:17
14146 Re:关于继承的深入讨论 jameszhang 216 2005-08-16 19:25
14178 Re:关于继承的深入讨论 whyuaou 161 2005-08-17 14:12
14298 Re:关于继承的深入讨论 ww1ww1 1399 2005-08-16 10:03
14201 Re:关于继承的深入讨论 ww1ww1 253 2005-08-16 20:38
14201 Re:关于继承的深入讨论 ww1ww1 273 2005-08-17 17:20
14145 Re:关于继承的深入讨论 breezehou 52 2005-08-17 12:58
14004 Re:关于继承的深入讨论 jameszhang 137 2005-08-17 21:09
14238 Re:关于继承的深入讨论 jokehan 289 2005-08-17 15:56
14084 Re:关于继承的深入讨论 jameszhang 1629 2005-08-17 21:41

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923