What is protected access?
What are some of the relative merits of using protected access vs. private access in base classes?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Aug 21, 2013, 11:15 PM
hi,
As explain above protected is also access by own class as well as its friend class(means derived class or sub class) so it you have requirement like member is only access by itseft and its friend class than you must define this member as a protected.
when you want to hide member from the outer world then you must define this meber as private.
hope this will help you.
Steph BassosPosted Aug 21, 2013, 11:04 PM
Jignesh TrivediPosted Aug 21, 2013, 10:55 PM
hi,
protected is only used/accessed by class and any sub class (derived class). whereas private can only access by class it seft.
Please refer
http://msdn.microsoft.com/en-us/library/ms173121.aspx
hope this will help you.