UML in object orientation
UML Diagram
How my example follows the UML models
This example is a system of vehicles. It has a base class that contains all the properties and methods that all objects of the vehicle class need. The base class vehicle is defined at the top. It has properties that are private to it and also has methods that are available to the entire system.
There are two derived classes called “watercraft” and “aircraft”. They represent distinct classes of object that are vehicles, but very different from each other. Objects in watercraft child class inherit all the properties of the vehicle class. They additionally include a property “hasSail” that only pertains to some objects in the watercraft class of objects. The same can be said of the derived class named “Aircraft”. It also inherits from the vehicle class and additionally defines its own.