I do this relation between two interface child. I want to display farther and son. Why it is null in this place? Thank you. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I do this relation between two interface child. I want to display farther and son. Why it is null in this place? Thank you.

Display var1 and var2. https://code.sololearn.com/c182B1Pl1wsh/?ref=app

25th Jun 2020, 6:30 AM
Malick Diagne
Malick Diagne - avatar
2 Answers
+ 3
If you expected values instead of the null-values, you have to take a closer look at the concept of objects. You create two different, independent instances of the same class. Of course they don't know each other. So the variables are not set as long as you do so. Btw. there is no "relation" between your two objects except of the fact, that they are of similar type.
25th Jun 2020, 6:52 AM
Sandra Meyer
Sandra Meyer - avatar
+ 1
Malick Diagne Please use relevant words in the thread tags, a relevant language be in order, Thank you!
25th Jun 2020, 6:58 AM
Ipang