+ 1

Inner Class

Although I understood how Inner Class Works. But I am still having a Doubt. Could you plz Clarify it??. I have Just Come up With a code-based up on a Youtube video. Can anyone explain how show() actually worked?? N why did I get a none in my Output. https://code.sololearn.com/c04Yq8q36A1x/#py

23rd Jul 2020, 6:13 AM
Mani
Mani - avatar
1 ответ
+ 2
Mani show() works because it is inside the class Laptop is inside the scope of Students. you defined the laptop class here: self.lap = Laptop() so anytime the Student's show method is called, it is refered to the Laptop's show method as defined here: self.lap.show() None is also shown because show's output is print and not return. So, call show() like this: s1.show() # don't add print Hope this clarifies some things 😃😃
23rd Jul 2020, 6:57 AM
Tomiwa Joseph
Tomiwa Joseph - avatar