Lose the
private
,class
members are private by default.setGolf()
: Instead of returning 1 or 0, you can apply exceptions management here. Also, you're doing double jobs by*this = Golf(name, hc);
. You call a constructor that creates an instance ofGolf
and then assign that instance to*this
when you don't even have an assignment operator defined. Don't worry, a default version is already generated.You can fix that by doing this:
this->fullname = name; this->handicap = hc;
Olayinka
- 273
- 1
- 10