Given that we have overloaded methods in base class, and a derived class that was inherited as private/protected.
- Can we restore only one/several of the original access level of the overloaded methods?
- On GCC 4.4.0 i try to put the base methods under protected access, then inherited it using private access. When i try to restore the access level to public, it works! Is this how its suppose to work? or is it a bug on the compiler? To my understanding, restoring access level shouldn't be able to be used to promote or demote a member's access level.
Code snippet :
class base {
public:
void method() {}
void method(int x) {}
protected:
void method2() {}
};
class derived : private base {
public:
base::method; // Here, i want to restore only the none parameterized method
base::method2; // method2 is now public??
};
задан Ignatius Reza 5 January 2011 в 17:32
поделиться