+ 2

Is there any way to use data members of private class in another class functions?

18th Feb 2018, 3:42 AM
Prankur Singrol
Prankur Singrol - avatar
3 Respostas
+ 1
No. Make them "protected" to be able to inherit in subclass.
18th Feb 2018, 3:50 AM
Harjeet Singh
Harjeet Singh - avatar
+ 1
Yes we can use friend function
2nd Aug 2019, 12:58 PM
Vaidehi Chotaliya
Vaidehi Chotaliya - avatar
0
Well i'd prefer to inherit than to make changes to both classes by adding "friend function".
18th Feb 2018, 3:55 AM
Harjeet Singh
Harjeet Singh - avatar