|
|
Access specifiers - C++ Class
|
Tutorials

Cpp

|
Topic |
How are access specifiers used in C++ classes?
|
|
Explanation |
|
Access specifiers defines the access rights for the statements or functions that
follows it until another access specifier or till the end of a class. The three types of access specifiers are "private",
"public", "protected".
private:
The members declared as "private" can be accessed only within the same class and not from outside the
class.
public:
The members declared as "public" are accessible within the class as well as from outside the class.
protected:
The members declared as "protected" cannot be accessed from outside the class, but can be accessed from a
derived class. This is used when inheritaance is applied to the members of a class.
|
| Note |
C++ is one of the most used programming languages in the world. Also known as "C with Classes".
Hope you enjoy this tutorial. Do send your feedback or suggestions on this C++ tutorial. This is a copyright content.
|
|
|
|