I haven't programmed in sometime and am rusty. I was never an expert either. I know my code has a simple error but I can't figure out what it is. I was practicing coding when I couldn't determine why the class constructor wasn't working as intended.
#include <iostream>
using std::cout;
class CBus
{
public:
int year;
char *model;
char *make;
CBus(int a, char *b, char *c);
bool operator>(CBus &aBus)const;
};
CBus::CBus(int a = 1995, char *b = Sedan, char *c = Mazda)
{
year = a;
model = b;
make = c;
}
bool CBus::operator>(CBus &aBus)const
{
return this->year > aBus.year;
}
int main()
{
CBus John(1998, Camry, Toyota);
CBus Pam(2012, Sedan, Toyota);
cout << " " << (Pam>(John));
}
I underlined and bold the words that intellisense put red lines under in my compiler.