+ 5
Can someone explain to me this code
6 Answers
+ 2
class B inherits the method from class A
class C inherits 2 methods (method and another_method) from B
so you can call any of the three method on the same object of class C
+ 2
@vaishanvi patil thanks so your calling the method
+ 2
at the last four lines you:
create an object of class C
invoke "method" on that object (you can do this because class C inherited it from A)
invoke another_method on that object (class C inherited it from B)
invoke third_method on that object (its class C's own method)
+ 1
@michal I understand that part what I don't understand are the last four lines
0
Inheritance concept, parent methods properties available by default to children classes and using last four line we are accessing methods from parents
0
In line 13 a variable c is identified to equal the class c āc = C()ā
Now since you understand what is before that, you know that class C inherited from class B and class B inherited from class A
Since line 13 connected variable c to class C, now variable c is connected to all Classes, which is tested in line 14-16