18.21. Interfaces Versus Abstract Base Classes


Programmers learning Visual Basic 2005 often ask about the difference between Interfaces and Abstract Base Classes. The key difference is in the semantics, the meaning of the two constructs. An abstract base class serves as the base class for a family of derived classes, while interfaces are meant to be mixed in with other inheritance trees.

Inheriting from an abstract class implements the is-a relationship. Implementing an interface defines a different relationship: the implements relationship. These two relationships are subtly different. A car is-a vehicle, but it might implement the CanBeBoughtWithABigLoan capability (as can a house, for example).



Programming Visual Basic 2005
Programming Visual Basic 2005
ISBN: 0596009496
EAN: 2147483647
Year: 2006
Pages: 162
Authors: Jesse Liberty

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net