Example #2: Inheritance Vehicles – This diagram shows an inheritance hierarchy a series of classes and their subclasses. Its for – an imaginary application that must model different kinds of vehicles such as bicycles, motor bike and cars. Notes All Vehicles have some common attributes (speed and color) and common behavior (turnLeft, turnRight) Bicycle and MotorVehicle are both kinds of Vehicle and are therefore shown to inherit from Vehicle. To put this another way, Vehicle is the superclass of both Bicycle and MotorVehicle In our model MotorVehicles have engines and license plates. Attributes have been added accordingly, along with some behavior that allows us to examine those attributes MotorVehicles is the base class of both MotorBike and Car, therefore these classes not only inherit the speed and color properties from Vehicle, but also the additional attributes and behavior from MotorVehicle Both MotorBike and Car have additional attributes and behavior which are specific to those kinds of object. Example #3: Mixed Example Company, Employee, Manager – This example is from a system that models companies, e.g. for a payroll or reporting system. See if you can interpret it yourself!
Example #2: Inheritance – Vehicles This diagram shows an inheritance hierarchy – a series of classes and their subclasses. Its for an imaginary application that must model different kinds of vehicles such as bicycles, motor bike and cars. Notes All Vehicles have some common attributes (speed and color) and common behavior (turnLeft, turnRight) Bicycle and MotorVehicle are both kinds of Vehicle and are therefore shown to inherit from Vehicle. To put this another way, Vehicle is the superclass of both Bicycle and MotorVehicle In our model MotorVehicles have engines and license plates. Attributes have been added accordingly, along with some behavior that allows us to examine those attributes MotorVehicles is the base class of both MotorBike and Car, therefore these classes not only inherit the speed and color properties from Vehicle, but also the additional attributes and behavior from MotorVehicle Both MotorBike and Car have additional attributes and behavior which are specific to those kinds of object. Example #3: Mixed Example – Company, Employee, Manager This example is from a system that models companies, e.g. for a payroll or reporting system. See if you can interpret it yourself!
intro-oosd-lab-2.docx