Access modifier in C++ by R4R Team

What is Access modifier?
in C++, there are 3 access modifier, i.e., public, private, protected.

Why Access modifier is used?
Access modifiers are used to implement an important feature of Object-Oriented Programming known as Data Hiding.

What is 'public' modifier:
Data member and data method which are declared as public are accessible from anywhere(inside or outside class).

What is 'private' modifier:
Data member and data method which are declared as private are accessible only within class.

What is 'protected' modifier:
Data member and data method which are declared as protected are accessible in same class or child class.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!