Question
What is the output of the following piece of code?class A():Â Â def disp(self):Â Â Â Â print("A disp()")class B(A):Â Â passobj = B()obj.disp()
Answer: Option D
Was this answer helpful ?
Class B inherits class A hence the function disp () becomes part of class B's definition. Hence disp() method is properly executed and the line is printed.
Was this answer helpful ?
More Questions on This Topic :
Question 1. Which of the following statements is true? ....
Question 3. Which function overloads the == operator? ....
Question 4. What is setattr() used for? ....
Submit Solution