0
can't understand question no 3/4 ch- inheritance.Can anyone out there to help me?
5 Antworten
+ 1
class C inherits from class B so it us class B's definition of function a.
In this line:
c = C()
C() creates an object of type C which is then assigned to the variable c.
In this line:
c.a()
This object stored in c calls the method a(), the one that was defined in class B because class C inherits from class B.
+ 1
Sorry, I meant to say uses not *us* in the first line of my first comment.
+ 1
@ Brian: but method in class B is derived from class A. So why isn't the answer 1?
+ 1
When a class that inheirits from another class with the same functions, the functions that are newer are kept.
0
thanks everyone😃
it seems a bit clearer than before