Topic: 多态性?多重继承? |
Print this page |
1.多态性?多重继承? | Copy to clipboard |
Posted by: truthawp Posted on: 2005-08-12 22:32 比如有这样两个例子: 1.class A{...} class B extends A{...} class C extends A{...} 2.class A{...} class B extends A{...} class C extends B{...} 1是表示JAVA的多态性;2是多重继承,是JAVA里所不允许的 是这样的么? |
2.Re:多态性?多重继承? [Re: truthawp] | Copy to clipboard |
Posted by: ranchgirl Posted on: 2005-08-12 23:45 truthawp wrote: Wrong! Read a book, please! Thanks! 1. Apple is a Fruit. Banana is a Fruit. 2. Apple is a Fruit. GuoGuangApple is an Apple Why not allowed, you never eat any apple with a brand name? Why don't you just compile the code to see what is allowed??? The following code is not allowed!!!!
Multi-inheritance is perfect legal in C++
|
3.Re:多态性?多重继承? [Re: truthawp] | Copy to clipboard |
Posted by: truthawp Posted on: 2005-08-13 18:54 thx,I see |
4.Re:多态性?多重继承? [Re: gongshi] | Copy to clipboard |
Posted by: decun Posted on: 2005-08-18 09:56 gongshi wrote: thanks。 some thing is invalid too.
|
5.Re:多态性?多重继承? [Re: gongshi] | Copy to clipboard |
Posted by: beyond1984 Posted on: 2005-08-18 12:09 Somebody says that 70% base-class can be rewritten in interface, you can use Muti-inheritance by implementing interface, eg: interface A{ void FuncA(); } interface B{ void FuncB(); } class AB implements A,B{ public void FuncA(){} public void FuncB(){} } That's all right,you do what you like as in C++. |
6.Re:多态性?多重继承? [Re: truthawp] | Copy to clipboard |
Posted by: brianlove Posted on: 2005-08-23 01:37 楼主,请看这篇贴,或许对你有帮助···· http://www.cjsdn.net/post/view?bid=1&id=151929&sty=1&tpg=1&age=0 |
7.Re:多态性?多重继承? [Re: truthawp] | Copy to clipboard |
Posted by: brianlove Posted on: 2005-08-23 01:40 楼主是不是说错了······· |
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 |