next up previous contents
Next: Example: Vehicles Up: Lecture 2: Classes, Objects, Previous: Generalisation (Inheritance) Relationships

Commentary

A subclass inherits attributes, operations and associations from its superclass. Usually further information is added to the subclass. An instance of a subclass can be used instead of an instance of its superclass. Inheritance is a class (type) relationship not object relationship. A subclass object inherits a superclass object characteristics through the inheritance relationship between the subclass and the superclass. Public superclass operations and attributes inherited remain public in the subclass. Private superclass operations and attributes inherited remain private in the subclass and so inaccessible to the subclass. Protected superclass operations and attributes remain protected and so accessible to the subclass. UML uses - for private, + for public and # for protected. A class in a hierarchy may be a superclass and a subclass.



Ananda Amatya
11/3/1999