I want to make a public member in the base class private in a derived class, for example:
class A {
public:
int x;
int y;
};
class B : public A {
private:
using y;
};
But, apparently, "use" cannot be used in this way. Is there any way to do this in C ++?
(I cannot use personal inheritance because there are other members and functions of A that should still be publicly available.)
source
share