What are the differences between public, private, and
protected access?

Answer Posted / koushik k reddy

Private:
It cannot be accessed by object and cannot be inherited, will be used only by the member functions of the class
Protected:
It cannot be accessed by the object and used by the member functions of the class can be inherited to first level of inheritance
Public:
It can be accessed by the objects and can be inherited to any level

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we declare a base-class destructor as virtual?

579


What is std :: flush?

570


What is a manipulative person?

536


What do you mean by storage classes?

785


Explain shallow copy?

610






What is c++ mutable?

696


What is class invariant in c++?

738


Mention the purpose of istream class?

613


Name the operators that cannot be overloaded in C++?

580


How do c++ struct differs from the c++ class?

586


What is virtual base class?

565


In what situations do you have to use initialization list rather than assignment in constructors?

627


What is size_type?

542


What is the keyword auto for?

564


Array base access faster or pointer base access is faster?

1809