Back to the hard slog of learning C++ after a longish break. Unfortunately it seems I've forgotten some in the meantime! Bruce Eckel's "Thinking in C++," chapter 14, question 15:
Create a class with two static member functions. Inherit from this class and redefine one of the member functions. Show that the other is hidden in the derived class.
So I have:
Code:
class Base
{
public:
static void f1() {cout << "static void f1()\n";}
static void f2() {cout << "static void f2()\n";}
};
class Derived : public Base
{
public:
static void f1() {cout << "Derived static void f1()\n";}
};
Am I correct in my understanding of "redefine" that the derived f1() redefines the base f1()? If so, what does the question mean that the other function is now "hidden"? Because it appears I can call both without error:
Code:
Derived::f1();
Derived::f2();