Sunday, December 16, 2007

A Small (silly) doubt regarding Abstract Classes in Java...!

Hi pa..!

I got a small ( & may be Stupid too, perhaps ! Pls. excuse me !) doubt today while looking at Abstract classes & Interfaces...
My doubt was(& STILL is..!)....

Why can't an Abstract class "extend" an Interface (which is like..umm...a purely Abstract class by the way...!! :-) )

Esp., why can't i have code like the following ??
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
interface SomeVerb_able {
// For example, *SomeVerb* may be say *Draw* ??...
void someAction( );
} /* end interface */
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// For example, *SomeVerb* may be say *Draw* ??...
// And *myAbstractClass* may well be..umm..*Shape*...??
abstract class myAbstractClass extends SomeVerb_able {
// Extra method specs...on top of those ALREADY in the Interface...
} /* end class */
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


NOW, i Do know that allowing that will cause some problems...but i jus' needed your valuable thoughts/ideas on this...

Thanks a lot in advance...!

Love & Best Wishes,
"r a g h u"







-------------------------------------------------
"We may bestow advice, but we cannot inspire the conduct. "
:- la Rochefoucauld
----------------------------------------
{
Ha ha ! My silly/stupid "doubt" has almosssst stirred a Storm in a Java-Cup..[er-no Tea-cup!! :) ] when i jusssst
Couldn't resist my-self from posting it on the Sun Java Forum today..!!
Well, well, well !
i'm one CRAZY Calvin, as you may well (not !) know !! ;-)
i simply DON"T care what people think/say when i got one of my trademark "DOUBTS"...which makes me feel so tooo DUMB & Restless that i MUSSSST ask them..atleast to My Self !! :)
Anyway, U can see the proceedings at:
}
-----------

1 comment:

Prashant Bhate said...

Well,

In real life, Though Difficult [not sure !], It is always possible to extend interfaces!

isn't it ;) [yet being abstract ?]

and guess that's how one should/[usually] get[s] "Inherited" :)))

Wondering why Java hasn't picked it up ?!! May be, they thought "Extends" is not appropriate for "Interface", But they knew the fact that Interfaces are merely meant to to implement :))))

Do "Extend" this blog, by "implementing" [Must I say "Inheriting"] some of your mail abstracts :))

Cheers,
Prashant Bhate

My Bookshelf-The tip o' the Ice-Berg..! :)