The task of my programm is to simulate a car service station workflow. One of its part is a registration of incoming vehicle (it can be a car, truck or bus). Depending of vehicle type programm have to choose those parts of vehicle which can be repaired. For Car - Hull, Breaks, Wheels. For Truck - same as for a Car AND Hydraulics. For Bus - same as for a Car AND Interiror.
I've created next set of classes:
//vehicle types
public abstract class Vehicle {}
public class Car : Vehicle {}
public class Truck : Vehicle {}
public class Bus : Vehicle {}
//vehicle parts types
public abstract class VehiclePart
{
public short State { get; set;}
public string Name
{
get { return this.GetType().Name; }
}
}
public abstract class CarVehiclePart : VehiclePart { }
public abstract class TruckVehiclePart : VehiclePart { }
public abstract class BusVehiclePart : VehiclePart { }
public class Hull : CarVehiclePart { }
public class Wheels : CarVehiclePart { }
public class Breaks : CarVehiclePart { }
public class Hydraulics : TruckVehiclePart { }
public class Interior : BusVehiclePart { }
public class Handrail : BusVehiclePart { }
What I try to achieve is to get full list of classes, presents parts for each type of vehicle. Can I do that with these classes or should I rewrite this huerarchy?
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire