- Use the protected keyword where ever possible for stop the data member to access out side world.
- Avoid the use of public keyword to expose the data members in the class.
- Use the protected keyword where ever possible, So that the derived classes have an access to them.
- To access the data from the class, use the member function (like get/set function). If the class might be inherited, then protected may be a good choice for that member function.
- By default access specifier for the class (member) is private.
Post a Comment
Subscribe to:
Post Comments (Atom)