CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS LANGUAGES C++ DETAILS
Question :
What is public, protected & private?



Category C++ Interview Questions
Rating (4.0) By 1 users
Added on 7/19/2006
Views 2187
Rate it!
Answers:

Private,public and protected are access specifiers..They are usually specified after the declaration after of data members.



public,protect,private are "access specifiers" .whenever we declare the variables under private it is not possible to access those variables out side the class.where as in public it is possible to access.



 Posted by: sreelatha    

Contact sreelatha  Contact sreelatha

public,protect,private are "access specifiers" .whenever we declare the variables under private it is not possible to access those variables out side the class.where as in public it is possible to access.



 Posted by: sreelatha    

Contact sreelatha  Contact sreelatha

public, protect and private are access specifiers, when a variable declared as private, it cannot be accessed outside the class. when a variable declared as public it can be accessed outside the class.

Member variables and member functions that are listed in a protected section of the interface definition are treated as though they were private, with one important exception: member functions of derived classes can access them when they occur as the base class part of a derived class object.



 Posted by: Anitha Murthy    

Contact Anitha Murthy  Contact Anitha Murthy

The private,public & protected are access specifiers in C++
1) private :- you will not have access outside the class
2) public :- You will have access outside the class
3) Protected :- You will have access within same class and derived class.



 Posted by: Vinayak Koli    

Contact Vinayak Koli  Contact Vinayak Koli

They are the access specifiers for the data members and member functions of the class to achieve the data binding.



 Posted by: mahendra    

Contact mahendra  Contact mahendra


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
What is polymorphism? Explain with an example?


View Answer
What is a class?


View Answer
What is the difference between structures and classes in C++?
View Answer
What is an object?


View Answer
What is the difference between class and structure?


View Answer
We can overload assignment operator as a normal function.But we can not overload assignment operator as friend function why?



View Answer
What are virtual functions?


View Answer
What is the Basic nature of "cin" and "cout" and what concept or principle we are using on those two?

View Answer
What is a scope resolution operator?


View Answer
What do you mean by inheritance?


View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C++ Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/6149/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.88