dissip
BigCat
发贴: 240
积分: 60
|
于 2006-03-03 13:24
I don't totally agree with you.
as i think, abstract class focus on inheritance while interface focus on interaction. inheritance 表示的是"is a"关系 (no mater whether it's extends or implements.)
decide what is the core of an object (as u said to be implements as abstract class) and what is the featureof the object(interface) is not easy. because object is just a model of reality, single object will be of no use. only interactions that can define the core of the object.
That is, when considering interactions between objects, we should focus on interface. and when considering code reuse (by inheritance), we should focus on abstract class.
and because java only support inheritance from one super class, the difference of them becomes more blur.
there are other disscuss of these 2 thing from other aspect on internet e.g. maintanance
To live is to fight.
|