Anonymous user
Inheritance/Single: Difference between revisions
m
copy edit - wiki link to wikipedia
No edit summary |
m (copy edit - wiki link to wikipedia) |
||
Line 9:
* components
* parts of the representation
The [[classes | class]] of the new type is a '''subclass''' of the classes rooted in the parent types. When all (in certain sense) properties of the parents are preserved by the derived type, it is said to be a [
Inheritance is
Line 17:
Some single inheritance languages usually allow multiple inheritance for certain [[abstract type]]s, interfaces in particular.
Inheritance can be considered as a relation parent-child. Parent types are sometimes called '''supertype''', the derived ones are '''subtype'''. This relation is [
'''Task''': Show a tree of types which inherit from each other. The top of the tree should be a class called Animal. The second level should have Dog and Cat. Under Dog should be Lab and Collie. None of the classes need to have any functions, the only thing they need to do is inherit from the specified superclasses (overriding functions should be shown in [[Polymorphism]]). The tree should look like this:
|