hi all
Can any one explain me when to use abstract classes and when to use interfaces. I get confused on this.
pl help
regards
sundar
-
Interfaces vs abstract classes (6 messages)
- Posted by: sundar varadarajan
- Posted on: May 22 2003 22:00 EDT
Threaded Messages (6)
- Interfaces vs abstract classes by kabal on May 23 2003 01:40 EDT
- Interfaces vs abstract classes by Chetans on May 23 2003 03:02 EDT
- Interfaces vs abstract classes by Max Kington on May 23 2003 12:31 EDT
-
Interfaces vs abstract classes by Gal Binyamini on May 23 2003 04:16 EDT
- Interfaces vs abstract classes by Aaron Robinson on May 23 2003 06:36 EDT
- Interfaces vs abstract classes by Chetans on May 23 2003 03:02 EDT
- abstract... by Sean Sullivan on May 24 2003 21:56 EDT
-
Interfaces vs abstract classes[ Go to top ]
- Posted by: kabal
- Posted on: May 23 2003 01:40 EDT
- in response to sundar varadarajan
An abstract class can have implemented methods where interfaces cannot.
Like an interface, an abstract class can also never be instantiated. Just FYI. -
Interfaces vs abstract classes[ Go to top ]
- Posted by: Chetans
- Posted on: May 23 2003 03:02 EDT
- in response to kabal
One thing which I will like to point here is
by default every interface is abstract.
what I will suggest to you is for understanding usage of interface over abstract or other way round, try getting hang of some of the patterns. With patterns you will be able to understand what kind of situation is getting solved and why perticular pattern has interface or abstract classes.
the thing is it is more of exp. and point of view, if you want behaviour to be encapsulated in you parent class as a default then go for abstract class if you just want to impose rule that any subclass shall implement some set of methods hence to have consistancy in method signature across the subclasses and hence finally hepling you code the module in more generalized way then go for interface. -
Interfaces vs abstract classes[ Go to top ]
- Posted by: Max Kington
- Posted on: May 23 2003 12:31 EDT
- in response to Chetans
Chetan is right here, also note that if extending an abstract class you then can't obviously extend anything else. You can on the other hand implement as many interfaces as you like.
Regards,
Max -
Interfaces vs abstract classes[ Go to top ]
- Posted by: Gal Binyamini
- Posted on: May 23 2003 16:16 EDT
- in response to Chetans
One thing which I will like to point here is by default every interface is abstract.
Huh? -
Interfaces vs abstract classes[ Go to top ]
- Posted by: Aaron Robinson
- Posted on: May 23 2003 18:36 EDT
- in response to Gal Binyamini
One thing which I will like to point here is by default every interface is abstract.
>
> Huh?
As in it doesn't have implementation -
abstract...[ Go to top ]
- Posted by: Sean Sullivan
- Posted on: May 24 2003 21:56 EDT
- in response to sundar varadarajan