मराठी

Differentiate Between Protected .And Private Me~Bers of a Class. in Context of Object Oriented Programming. Also, Give a Suitable Example Illustrating Accessibility/Non-accessibility of Each Using a Class and an Object in C++. - Computer Science (C++)

Advertisements
Advertisements

प्रश्न

Differentiate between protected .and private me~bers of a class. in context of Object Oriented Programming. Also, give a suitable example illustrating accessibility/non-accessibility of each using a class and an object in C++.

उत्तर

Protected Member: Protected Members are the members that can be used only by member functions and friends of the class in which it is declared. The protected members are similar to private members that they cannot be accessed by non-member functions.Protected members are inheritable but private members are non-inheritable.

Private Members: Private Members are the class members that are hidden from the outside world. The private members implement the OOP concept of data hiding. The private members of a class can be used only by member functions (and friends) of the class in which it is declared.

shaalaa.com
Using Private and Public Visibility Modes, Default Visibility Mode (Private)
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2016-2017 (March) All India Set 4
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×