class Vehicle {
public:
int passengers; // number of passengers
int fuelcap; // fuel capacity in gallons
int mpg; // fuel consumption in miles per gallon
int range(); // compute and return the range
}
// Implement the range member function
int Vehicle::range()
{
return mpg * fuelcap;
}
Errors:
- new types may not be defined in a return type
- extraneous `int' ignored
- prototype for `Vehicle Vehicle::range()' does not match any in class `Vehicle'
- `Vehicle Vehicle::range()' and `int Vehicle::range()' cannot be overloaded
- conversion from `int' to non-scalar type `Vehicle' requested
Looking at other examples I can't see that I've gone wrong although clearly I have. Could someone clear up the confusion please?