okay i'm sorry if my question not clear enough.
ths first question is about the inherent, from your answers above i understand that the vehicle class is inherent. so i just have to link with the subclasess by the VehicleId. (( this is only to ensure! ))
anyway, when i print the id for vehicles it shows me strange numbers. it should start form 1 and increase by one in each time
here is the code in the main programe.
1 2
|
vector<Vehicle*> vehicles;
int VehicleId = 1;
|
for the driver class, the id works fine.
the second problem, i want to assign one driver to specific vehicle, and one vehicle to specific driver, so i need composition. could you show me only simple code for this according to my code above? i need to understand how to do.
also there is another problem, i want to print "there is no vehicle in the list" in case the vehicle class is empty.
i use this code
if(vehicles[i]->PrintVehicleId() == 0) cout<<"there is no vehicles in the list"<<endl;
but it shows me errors
thank you and i appreciate your help