C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers

114 comments

10,705 users

How can we access protected and private members of a class?

0 votes
20 views
asked by smith Geek (15,340 points)

1 Answer

0 votes
In the case of members protected and private, these could not be accessed from outside the same

class at which they are declared. This rule can be transgressed with the use of the friend keyword in a

class, so we can allow an external function to gain access to the protected and private members of a class.
answered by rajesh Guru (39,140 points)

Related questions

0 votes
1 answer 26 views
26 views asked by smith Geek (15,340 points)
0 votes
1 answer 12 views
12 views asked by john Guru (27,140 points)
0 votes
1 answer 33 views
0 votes
1 answer 42 views
42 views asked by rock Expert (14,990 points)
0 votes
1 answer 46 views
...