The access specifier of a base class member can be changed in a derived class by an access declaration, as in this example:
class A{public: int n; };class D : public A{private: A::n; // access declaration changes access of A::n to private; deprecated};
According the ANSI/ISO Standard, the use of access declarations is considered deprecated. Instead, you should use a using declaration for that purpose:
class D : public A // using-declaration version{private: using A::n; // using declaration changes the access of A::n to private};
Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.























