I haven\'t done C++ in a while and can\'t figure out why following doesn\'t work:
class A { protected: int num; }; class B : public A { }; main () { B
yes protected members are accessible by derived classes but you are accessing it in the main() function, which is outside the hierarchy. If you declare a method in the class B and access num it will be fine.