I am sure there is nothing wrong with this... I am racking my brain as to why it wont compile.
#include <iostream>
#include <string>
using namespace std;
class Vehicle {
public:
Vehicle();
Vehicle(string m, int y);
void print() const;
protected:
string model;
int year;
};
void Vehicle::print() const {
cout << "Model = " << model << " , year = " << year << endl;
}
int main() {
Vehicle a; //something extremely basic is moaning about this line
//if i use Vehicle a(); it seems to work but the rest of it has //problems because i used the parenthesis
a.print();
}
the error is:
C:/Documents and Settings/Daryl/My Documents/159234/study1/inheritance.cpp:22: undefined reference to `Vehicle::Vehicle()'