December 1998
Intermediate to advanced
624 pages
13h 8m
English
This chapter presents the three types of access control in C++ classes. Access controls allow the programmer to declare a class's members as public:, protected:, and/or private:.
private:, protected:, and public: different?The situation is similar to personal secrets (shared only with friends), family secrets (shared with friends and children), and nonsecrets (shared with anybody), respectively.
A private: member of a class is accessible only by members and friends of the class.
A protected: member of a class is accessible by members and friends of the class and by members and friends of derived classes, provided they access the base member via a ...
Read now
Unlock full access