CSE 205 Study Guide - Midterm Guide: Instance Variable

392 views2 pages

Document Summary

The set of all methods provided by a class, together with a description of their behavior, is called the public interface of the class. The process of providing a public interface, while hiding the implementation details, is called encapsulation. In object-oriented design, inheritance is a relationship between a more general class (called the superclass) and a more specialized class (called the subclass). The subclass inherits data and behavior from the superclass. Suppose we have an algorithm that manipulates a vehicle object. Because a car is a special kind of vehicle, we can use a car object in such an algorithm, and it will work correctly. The substitution principle states that you can always use a subclass object when a superclass object is expected. The subclass inherits all public methods from the superclass. You declare any methods that are new to the subclass, and change the implementation of inherited methods if the inherited behavior is not appropriate.