Access Specifiers in C++
Access Specifiers in C++
Access specifier used to implement an important aspect of OOPs known as data hiding .
Access specifier or Access modifier in a class are used to assign the accessibility to the class member i.e. , they set some restrictions on the class members so that they can not be directly accessed by the outside functions .
Types Of Access Specifiers
There are three types of access specifiers :-
- Public
- Private
- Protected
Public Access Specifier :-
All the class members declared under the public specifier will be available to everyone . The data members and member functions declared as public can be accessed by other classes and function too .
Private Access Specifier :-
The class members declared as private can be accessed only by the member functions inside the class . They are not allowed to be accessed directly by any object or function outside the class , only the member functions are allowed to access the private data member of the class .
Protected Access Specifier :-
The protected access specifier is similar to the private access specifier in the sense that it can not be accessed outside of its class . The difference is that the class member declared as protected can be accessed by any subclass of that class as well .
Topics Covered :
- access modifiers
- access specifiers in c++
- private and protected access specifiers in c++
- c++ access specifier
- c++ programming
Thanks for reading this blog. Hope you get satisfied with the blog and definitely this blog must have valued your time and effort of reading.
Take a time to connect our other digital creations such as Instagram , Facebook and Youtube.
Social Media Links of Tech DCode :
YouTube : https://www.youtube.com/channel/UCjJnEdeugftBwQ3yMuD4B_A
Instagram : https://www.instagram.com/thetechdcode/
Facebook Page : https://www.facebook.com/thetechdcode
Twitter : https://twitter.com/thetechdcode
Telegram Channel : https://t.me/thetechdcode
Tech DCode Linktree : https://linktr.ee/thetechdcode
My Personal Handles : https://linktr.ee/virtualshivamin
Social Media Links of SHIVAM SINGH (OWNER) :
Instagram : https://www.instagram.com/virtualshivamin/
Facebook Page : https://www.facebook.com/virtualshivamin/
Twitter : https://twitter.com/virtualshivamin/
Personal Linktree : https://linktr.ee/virtualshivamin