I am working on a project that require us to use inheritance and polymorphism. The program is not complete, this is what I have got so far, but I am not sure what I am doing wrong.
I'm getting this error. Line 10:int Vehicle::year' is private.
Please help me.
You did not put [code][/code] tags around your code.
You did not include the main() function.
That said, you cannot access something that is private in the subclass (Car and Truck).
If you want to inherit something that should not be accessible outside, use protected instead of private in Vehicle.
I am sorry for not putting the tags around my code. Thank you catfish it does work with protected. I am having another problem, when I run the program, the style of the car and the wheels of the truck are not printing, is there anything wrong in my void print?