Define private, protected and public access control.
Page 1 of 1
Define private, protected and public access control.
Private
Private is the default access specifier for every declared data item in a class. Private data belongs to the same class in which it is created and can only be used by the other members of the same class.
Protected
When a data item is declared as protected it is only accessible by the derived class member.
Public
Public allows to use the declared data item used by anyone from anywhere in the program. Data items declared in public are open to all and can be accessed by anyone willing to use their values and functions they provide.
Similar topics
» Explain public, protected, private in C++?
» 3 Important benefits of Digital Public Relation
» What is the default access level?
» Different access specifiers for the class member in C++
» How to control the number of chars read in a string by using scanf()?
» 3 Important benefits of Digital Public Relation
» What is the default access level?
» Different access specifiers for the class member in C++
» How to control the number of chars read in a string by using scanf()?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|