Generally, we wish to use private inheritance to hide the implementation details to the base class. If this is true,
1) Why is the name publicizing feature is there again ? Is it only for language completeness or is there any practical usage also?
2) Even though I publicize the base class function name, a derived class can still declare another function with same name. Please consider the following code.
#include "iostream"
using namespace std;
class Base {
public:
int zoo;
Base() {zoo =5;}
int sleep() const {return 3;}
};
class Derived : Base { // Private inheritance
public:
using Base::zoo;
using Base::sleep;
int sleep() const { return 4.0; }
};
int main() {
Derived der;
der.sleep();
cout<<" zoo is : "<<der.zoo<<endl;
cout<<" Sleep is : "<<der.sleep()<<endl;
}
In the above snippet, even though we publicize the name, we can still declare the name in derived class, and we can access the base class version of member variables. How the memory is managed?
Thank you.
http://en.cppreference.com/w/cpp/language/using_declaration
That link has specific examples of exactly what you are doing an re-iterates what I quoted above and how the base member is simply hidden by the derived member.