This the code that makes up my program. There are 3 header files and a single .cpp file. When I build the program however I get the errors:
I have 6 errors for the '<<' operator that you will see if you compile it also. I was wondering what I am doing wrong that is causing these errors. Much appreciated
I'm not sure what you mean to have happen in the print functions. It looks like you're trying to output the result of a function (and the same function you've originally called) that is void and doesn't return anything. Did you want to print out some of the values of the data members specific to a car?
OP: Seems you are carrying on irregardless since previous thread (http://www.cplusplus.com/forum/general/203113/) despite a strong case for not having public inheritance, particularly with virtual functions, at all in this situation
Quoting Stephen Prata, C++ Primer Plus (5th ed)
Nothing in the C++ language prevents you from using public inheritance to model has-a, is implemented-as-a, or uses-a relationships. However, doing so usually leads to programming problems
In your case the best approach would be to use containment i.e.
1 2 3 4 5 6 7 8 9
class CarbonFootprint {...};
class Car
{
private:
CarbonFootprint cfCar;
...
...
};
//and so on for the other classes