+ 5

I Dont understand what is wrong with my code, help me please😔

Why the compiler says that int age and string name are private, yes they are but why it is a bug? https://code.sololearn.com/cc2c6hrg8757/?ref=app

13th May 2020, 3:06 PM
Luis.G
Luis.G - avatar
1 ответ
+ 5
That's because you are trying to access them using Student::Saludar() function which is a memeber function of "Student" class not "person" class Even though student is inheriting person class but as you might know , private members can't be inherited you can declare them protected to let them inheritable. 👇 https://code.sololearn.com/cO0Z3EjauOJd/?ref=app
13th May 2020, 3:17 PM
Arsenic
Arsenic - avatar