c++ - Use the private variable of the superclass with friend -
i have class private variable a. class b subclass of a. in class b_test, wrtite "b b; b.a;", put friend class c in both class , class b still no works.
any idea? thank you.
(sorry make mistake in code when post question. solved now). rod_algonquin right. thank you.)
private members not inherited. if want access member in inherited class, need use protected
modifier.
Comments
Post a Comment