Help me !! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Help me !!

At line 2, We are using access specifier ::private,then how does output comes without any error?? https://code.sololearn.com/ca24a4138a0a/?ref=app

11th Mar 2021, 3:57 AM
__n
__n - avatar
4 Answers
+ 2
t1,t2 are protected variables in their classes. And you are inheriting as B as protected to D so t1 becomes a protected variable to D now, D as private to DD class so t1, t2 becomes peivate variable to DD. So with in DD class you can use t1,t2 . But if you inherit DD to another class , you won't access t1,t2 in derived class because t1,t2 private in DD class. Not available to further derived class but available to DD. Hope it make sence...
11th Mar 2021, 9:43 AM
Jayakrishna 🇮🇳
+ 2
nice support
13th Mar 2021, 1:20 AM
Jedo Frye
Jedo Frye - avatar
+ 1
11th Mar 2021, 11:26 AM
__n
__n - avatar
+ 1
You're welcome __n
11th Mar 2021, 5:33 PM
Jayakrishna 🇮🇳