Technical Discussion :: C++
Home > Freshers > Technical Interview Questions > C++
102. How can we access private members of a classs?
Answer:
By using a friend function.
A friend function has access to all private and protected members of the class for which it is a friend.
Asked In :: TCS iGate Virtusa Syntel Inc. Accenture
By using a friend function.
A friend function has access to all private and protected members of the class for which it is a friend.
A friend function has access to all private and protected members of the class for which it is a friend.