Is it legal to do so (this is just header files, and .cpp files contain the function definitions):
class Human
{
protected:
std::string m_name;
int m_age;
public:
Human();
void printName() const;
void printAge() const;
};
And re-define the same void printName() const;
(which is not virtual
) in the derived class.
class Student : public Human
{
public:
Student();
void printName() const;
void study() const;
};
What is this? This is not overriding. But it is not overloading too, right? As far as overloading should have different type or number of arguments (method is constant in both places). What have I done here?