Write THREE (3) classes in a file named hidden.h, where class footballer functions as a base class, while class divisionOne and class divisionTwo function as derived classes to class footballer.
There are 3 tables given. We must construct a header file named hidden.h.
......................................................
footballer (class)
# name : string
# club : string
#goals : int
# bonusSalary : double
____________________________
<<constructor>> +
footballer(n : string, c : string, g : int)
+
salary()
.......................................................
......................................................................
___________________________________
divisionOne
<<constructor>> +
divisionOne(n : string, c : string, g : double) -
salary()
.....................................................................
.....................................................................
___________________________________
divisionTwo
<<constructor>> +
divisionTwo(n : string, c : string, g : double) -
salary()
.......................................................................
Write THREE (3) classes in a file named hidden.h, where class footballer functions as a base class, while class divisionOne and class divisionTwo function as derived classes to class footballer.
class Xyz {
// everything is private here (optionally you may use the key word private
// ...
public:
// everything is public here.
// ...
protected:
// everything is protected here
// ...
};
You inherit like this:
1 2 3
class Xy : public Xyz {
// same as above
};
If you need to use polymorphism, you may want to read about virtual as well.