CSC/ECE 517 Fall 2011/ch6 6b mm

From Expertiza_Wiki
Revision as of 05:42, 15 November 2011 by Mrmanrin (talk | contribs)
Jump to navigation Jump to search

Subclassing

Introduction

Subclassing, or inheritance, in object-oriented programming grants the programmer the ability to extend and refine the functionality of existing classes. This principle has many advantages that can make the programmers life much more simple. Principles and techniques have been defined that support and oppose the use of subclassing, making for a great debate. Here, some of these principles will be discussed to help determine when it is a good idea to utilize subclassing in a program.

Liskov Substitution Principle

Probably the most well-known subclassing principle is the Liskov Substitution Principle (LSP). It states:

If S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e., objects of type S may be substitutes for objects of type T) without altering any of the desirable properties of that program (correctness, task performed, etc.).

References

Liskov Substitution Principle Wikipedia

Citation Notes

Full References

http://en.wikipedia.org/wiki/Liskov_substitution_principle

External Links