Re: same old question: interface Vs. Abstract class
- From: iamfractal@xxxxxxxxxxx
- Date: 9 May 2005 02:16:37 -0700
zeroone wrote:
> Hi all,
>
>
> I m a C++ programmer basically & recently got into JAVA tech.
>
> I have 2 doubts:
Snip 1 ...
>
> Suppose I m damn sure that my kid concrete class objects will have
> different behaviour for same request issued and all methods will be
> clubed within one dady ABC. Then I think I should use ABC only over
> interface for speed optimization.
Speed optimization? I take it you mean the speed of execution of the
eventual product. Have you read somewhere that a subclassed object runs
faster than an object that implements an interface? I am unaware of any
such differentiation.
That aside, given the certainty of your design above, I would see no
reason to favour ABC over an interface except for the reason I usually
read in such circumstances: if any of your subclasses' methods have
common, default behaviour, then ABC is the better choice, as the ABC
can describe the default behaviour, rather than having identical
methods in each of the subclasses.
>
> Here is some sample code that I thought will help u guys understand
me
> better.
Snip 2 ...
>
>
> -----------
> SECOND
> -----------
>
Snip 3 ...
>
> In C++ its MI provided programmers dont do stupidty.
>
> How will one phrase the same in JAVA. Its obvious I define interfaces
> in C++. I write ABC with all the stuff virtual.
I'm not 100% what you mean by, "How will one phrase the same in JAVA;"
do you mean, "How do you implement such multiple-inheritance in Java?"
I presume you're not asking that, as you know Java has only
single-inheritance; and that the only way to implement the above is
with at most one ABC per class, and all other mixin functionality with
interfaces.
Hmm ...
..ed
www.EdmundKirwan.com - Home of The Fractal Class Composition.
.
- References:
- same old question: interface Vs. Abstract class
- From: zeroone
- same old question: interface Vs. Abstract class
- Prev by Date: Re: get unicode values from string
- Next by Date: Re: Help needed building 3D modelling/mapping application
- Previous by thread: Re: same old question: interface Vs. Abstract class
- Next by thread: Unsupported major.minor version 49.0
- Index(es):
Relevant Pages
|