Re: Confuesd about abstract class vs interface
From: Chuck Bowling (chuckbowling_at_sbcglobal-NO-SPAM.net)
Date: 12/22/04
- Next message: J.Marsch: "Plugins for Firefox?"
- Previous message: Nicholas Paldino [.NET/C# MVP]: "Re: need help with a typedef"
- In reply to: phl: "Confuesd about abstract class vs interface"
- Next in thread: Bruce Wood: "Re: Confuesd about abstract class vs interface"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 22 Dec 2004 11:22:28 -0500
An abstract class is kind of like a new car. You start out with a basic no
frills car (your abstract class), then you add too it - superduper radio,
custom paint, nice wheels. That's inheritance. You inherited the basic car
and added features via your inheriting class.
An interface is a promise that your class will implement a set of methods
specified by the interface. An instance of a class that uses another class
containing an interface knows that it can rely on that class to provide
functions promised by the interface.
"phl" <killkennyhouse@hotmail.com> wrote in message
news:1103715301.228141.162380@f14g2000cwb.googlegroups.com...
> hi,
>
> I am kind of confused aobut interfaces and abstract classes.
>
> In short as I understand it, an interface is like a contract between
> the class and the interface, so that certain funtions must be
> implemented. So if you have a class which inherits base class that
> inherts an interface, then your classes will have a standard. I suppose
> you can also check for interface at run time say when dll is loaded and
> see if it implememts whats required by interface also before loading
> it.
>
> I have never used abstract classes, as I understand it, its for
> creating a base class with function without any implementation, so that
> it can be done in your inherited class. I am confused why you would
> need this, as you already can override functions and also theres
> interfaces.
>
> I have probably misunderstood something, can someone please explain.
> The reason i am interested is because I am writing a system which i
> hope to be well maintained in the future. I want other people to add
> classes with specific implementations.
>
> thanks
>
- Next message: J.Marsch: "Plugins for Firefox?"
- Previous message: Nicholas Paldino [.NET/C# MVP]: "Re: need help with a typedef"
- In reply to: phl: "Confuesd about abstract class vs interface"
- Next in thread: Bruce Wood: "Re: Confuesd about abstract class vs interface"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|