+ 1
If I have a class A , class B and create an object of A in the main class( example A.yell()). How can access this opject of the
A class out of the B class?
9 Réponses
+ 1
does anyone have an idea?
+ 1
best way is to use inheritance where you can use super() so you use menu as super class and use it as parent class in submenu so you can just use super method to access parent properties
0
for better understanding can post sample code jsut structure please because it's confusing
0
ok wait a mom
0
here is an example https://code.sololearn.com/cVyD06xBw0d6/?ref=app
0
hai in your menu1 case 1 I see you called sub1 after beak which will not work so put it on top of beak
0
I changed but how I get acces to the m.menu1 object out of the submenu class
0
after it prints in submenu it will go back to menu1 as it is the caller so if print anything after calling submenu in menu1 you will get it printed
0
but the m.menu1 is an object of the main class. how can I use the existing object in the submenuclass