0

can't understand question no 3/4 ch- inheritance.Can anyone out there to help me?

21st Oct 2016, 12:18 PM
Sabiba Hossain
Sabiba Hossain - avatar
5 ответов
+ 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.
29th Oct 2016, 12:31 PM
Brian
+ 1
Sorry, I meant to say uses not *us* in the first line of my first comment.
29th Oct 2016, 12:33 PM
Brian
+ 1
@ Brian: but method in class B is derived from class A. So why isn't the answer 1?
8th Nov 2016, 5:37 PM
Uohna
Uohna - avatar
+ 1
When a class that inheirits from another class with the same functions, the functions that are newer are kept.
16th Nov 2016, 4:48 PM
Michelle Anderson
Michelle Anderson - avatar
0
thanks everyone😃 it seems a bit clearer than before
21st Dec 2016, 5:26 PM
Sabiba Hossain
Sabiba Hossain - avatar