[Solar-talk] [fw-general] [OT] interfaces or abstract classes

Alexander Veremyev alexander.v at zend.com
Wed Sep 20 13:19:54 PDT 2006


Hi,

I think short answer is:
- use inheritance and abstract classes, when you can say "... is a kind 
of ..."
- use interfaces, when you can say "... can be used as ..."

There are also a lot of good articles related on this topic in Wikipedia.
http://en.wikipedia.org/wiki/Object-oriented_programming
http://en.wikipedia.org/wiki/Interface_%28computer_science%29
http://en.wikipedia.org/wiki/Inheritance_%28computer_science%29
http://en.wikipedia.org/wiki/Protocol_%28object-oriented_programming%29


With best regards,
    Alexander Veremyev.

Stuardo -StR- Rodríguez wrote:
> Sorry to ask here this but I have no other place to ask
> 
> My question is...  when should I use interfaces and when to use abstract 
> classes.
> 
> I do understand that interfaces are just a list of methods some concrete class 
> should implement and nothing more
> 
> Abstract class are like a interfaces but they can tell wich methods are 
> abstract and wich are already defined.. so that is a + for using abstract 
> classes
> 
> But a concrete class can implement not just one interface but can only extend 
> from one single abstract class so that is a + for using interfaces
> 
> But that is all I can see...   so after that, I do not get when to use 
> interfaces and when to use abstrac classes.   So, if we could inherit from 
> many abstrac classes, we would never need interfaces, right?
> **
> Can anyone help me to understand this?
> 
> 



More information about the solar-talk mailing list