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

Explain shallow copy?

616


What is an orthogonal base class in c++?

662


Name four predefined macros.

596


Why do you use the namespace feature?

656


Difference between a copy constructor and an assignment operator.

580






Is facebook written in c++?

564


Is c++ primer good for beginners?

593


Do inline functions improve performance?

650


What are the defining traits of an object-oriented language?

697


What is code reusability in c++?

672


Write is a binary search tree? Write an algo and tell complexity?

598


What is meant by a delegate?

611


Describe the advantages of operator overloading?

577


Why do we use templates?

606


What is the use of 'this' pointer?

774