well syntax errors i agree but logical errors and good coding standards errors abound.
Code:
#ifndef LEN
#define LEN 25
Whats that?
You shouldnt ( read never) do that.
do this...
Code:
//alt 1...
const unsigned int LEN = 25;
//alt2...
namespace
{
const unsigned int LEN = 25;
}
// which is equivalent to this now deprecated use of static
static const int LEN = 25;
I would suggest doing this....
Code:
private:
char name_[LEN];
char model_[LEN];
int year_;
because it then allows you to do this...
Code:
Car(const char *model, const char *name, int year);
Now you can easily see what the params for the constructor are. Single letter variable names are usually next to useless except for maybe loop variables.
What are you doing here?
Code:
const Car operator +(const Journey& meter) const;
const Car operator +(const FuelPurchase& amount) const;
Firstly operator + should be a non-member. Secondly if you describe a car as a name,model and year what exactly does it mean to add either a fuelpurchase or a journey to that data and come up with a whole new car. Surely both are illogical.