6. UML diagram: Inheritance
A key property of OOP is inheritance. The diagram below shows the superclass 'train journey' as having two derived classes namely a freight train and a passenger train.
Inheritance is shown as an open arrow between the diagrams. Both freight and passenger class have the data and methods of train journey and they also have their own unique data and methods. You can also show the lines as a tree structure as shown below
Challenge see if you can find out one extra fact on this topic that we haven't already told you
Click on this link: UML class inheritance
Copyright © www.teach-ict.com