Example:
class Person
{
private:
int age;
public:
int getAge()
{
return age;
}
};
class Employee: public Person
{
private:
int empNum;
};
Now say I want to overload the + operator to add the ages of two employee objects. One of those employee objects calls the overloaded operator function, but in this instance, I also need that object to call the getAge() function from the base class. I know I could just make age protected instead of private, but is there a way to do this leaving that property private?