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

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c# - Why won't my code write to SQL? -

c# - Avoiding duplicate methods for Task and Task<T> -