Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > difference between inheritance and interface?

Reply
Thread Tools

difference between inheritance and interface?

 
 
syntax
Guest
Posts: n/a
 
      02-11-2004
what is the difference between one level inheritance and one level
implementation of interface ?

i.e



what is the difference between the following :


class myclass extends abc
{
....
}

AND

class myclass implements interface_name
{
....
}
 
Reply With Quote
 
 
 
 
Ryan Stewart
Guest
Posts: n/a
 
      02-11-2004
"syntax" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> what is the difference between one level inheritance and one level
> implementation of interface ?
>
> i.e
>
>
>
> what is the difference between the following :
>
>
> class myclass extends abc
> {
> ...
> }
>
> AND
>
> class myclass implements interface_name
> {
> ...
> }


For an extensive discussion of class vs interface, see "abstract class
versus interface" and "Design - inheritance vs interface" threads in
comp.lang.java.programmer.


 
Reply With Quote
 
 
 
 
Collin VanDyck
Guest
Posts: n/a
 
      02-11-2004
By implementing an interface, your object guarantees that the methods laid
out in the interface will be implemented.

By extending a base class (inheritance), you inherit from the base class
public and protected instance methods and members. In other words, those
methods and members are accessible from your new object.



"syntax" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> what is the difference between one level inheritance and one level
> implementation of interface ?
>
> i.e
>
>
>
> what is the difference between the following :
>
>
> class myclass extends abc
> {
> ...
> }
>
> AND
>
> class myclass implements interface_name
> {
> ...
> }



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ 7.17 What's the difference between dynamic and lexical (static) scoping? Between local() and my()? PerlFAQ Server Perl Misc 0 04-15-2011 04:00 AM
FAQ 7.17 What's the difference between dynamic and lexical (static) scoping? Between local() and my()? PerlFAQ Server Perl Misc 0 01-06-2011 05:00 PM
difference between inheritance and mixin Vellingiri Arul Ruby 6 09-26-2007 09:19 PM
Difference between bin and obj directories and difference between project references and dll references jakk ASP .Net 4 03-22-2005 09:23 PM
Exact difference between 'const char *' and 'char *', also diff between 'const' and 'static' Santa C Programming 1 07-17-2003 02:10 PM



Advertisments