Re: difference between inheritance and interface?

From: Collin VanDyck (thehoppocket_at_yahoo.com)
Date: 02/11/04


Date: Wed, 11 Feb 2004 20:42:45 GMT

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" <sanko50@yahoo.com.hk> wrote in message
news:5c553dbf.0402111228.18f3a7b2@posting.google.com...
> 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
> {
> ...
> }



Relevant Pages

  • Re: Pulling my hair out, I need some help
    ... base class was just that i noticed that a base class saved me more typing ... as using the interface, to the other programmers in my company i made both ... is that the plug-in must meet. ... Inheritance, it is less clear which methods and properties of the ...
    (microsoft.public.dotnet.languages.vb)
  • Re: User Controls (Active X) - Da Process
    ... VB can't do 'real' inheritance. ... VB's 'interface inheritance' is more like interface duplication, ... Even if the class delegates to an internally held base class, ... is duplicated for every level of inheiritance. ...
    (microsoft.public.vb.general.discussion)
  • Re: interface vs. inheritance
    ... 2)Avoid extending a class unless it was designed to be extended. ... 3)If you have a well defined contract that will be implemented by many ... An interface represents a purely abstract IS_A ... consider using a base class so that you ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Deriving - .NET example
    ... the case of the lack of multiple implementation inheritance: ... could try to use aggregation to implement several interfaces at once, ... Inheritance is so easy because with three lines of code you get all the functionality of the base class + the public interface of the base class + access to its protected members + the possibility to override some of its implementation. ...
    (comp.object)
  • Re: User Controls (Active X) - Da Process
    ... VB can't do 'real' inheritance. ... For me inheritance includes the implementation as well as the interface. ... code is a duplication of whats in the base class. ... duplicated for every level of inheiritance. ...
    (microsoft.public.vb.general.discussion)