+ 1

What does exactly the protected access specifier means

25th Sep 2017, 3:54 AM
dhiman mishra
dhiman mishra - avatar
3 odpowiedzi
+ 1
It actually not assess by dot operator but can be inserted in another class eg. class A { int a; public: A() {a=2;} protected: int c; }; class B: public A { int x; public: B() {x=c;} //will not produce any error //because c is a protected member }; void main() { A obj; obj.a=2;. //error because a is private obj.c=3;. //error because c is protected B obj1; }
25th Sep 2017, 4:29 AM
subham sahu
subham sahu - avatar
+ 1
Thanks brother
25th Sep 2017, 4:48 AM
dhiman mishra
dhiman mishra - avatar