Salbrismind
September 9th, 2009, 03:19 PM
I've been searching around trying to find some good information in the issue of figuring out which to use at any given time, Interfaces or Abstract Classes?
I've read a lot of people using the idea that Interfaces are contracts, but aren't Abstract Classes as well? (or at least they can be?) The differences are that Interfaces must contains only virtual functions (abstract functions) and static variables. While Abstract Classes can have anything.
Am I right to think, then, that you should use Abstract Classes when you want add variables, and fully implemented functions to objects. (I'm specifically considering the multiple inheritance in languages like C#) While Interfaces are only for things which have no implementation of there own.
I'm definately not an expert, and I'm sure I'm missing something important.
Anyways, what's your thoughts?
I've read a lot of people using the idea that Interfaces are contracts, but aren't Abstract Classes as well? (or at least they can be?) The differences are that Interfaces must contains only virtual functions (abstract functions) and static variables. While Abstract Classes can have anything.
Am I right to think, then, that you should use Abstract Classes when you want add variables, and fully implemented functions to objects. (I'm specifically considering the multiple inheritance in languages like C#) While Interfaces are only for things which have no implementation of there own.
I'm definately not an expert, and I'm sure I'm missing something important.
Anyways, what's your thoughts?