Define an abstract class “car” with members reg_no, model, reg_date. Define two subclasses of this class – “transportVehicles ” (validity_no, start_date, period) and “privateVehicle ” (owner_name, owner_address). Define appropriate constructors. Create n objects which could be of either transportVehicles or privateVehicle class by asking the user’s choice. Display details of all “privateVehicle” objects and all “transportVehicles” objects.
Answers
Answered by
1
Explanation:
Define an abstract class “car” with members reg_no, model, reg_date. Define two subclasses of this class – “transportVehicles ” (validity_no, start_date, period) and “privateVehicle ” (owner_name, owner_address). Define appropriate constructors. Create n objects which could be of either transportVehicles or privateVehicle class by asking the user’s choice. Display details of all “privateVehicle” objects and all “transportVehicles”
Similar questions