Discussion :: Python MCQs
-
What is the output of the following piece of code?class Demo:def __init__(self):self.x = 1def change(self):self.x = 10class Demo_derived(Demo):def change(self):self.x=self.x+1return self.xdef main():obj = Demo_derived()print(obj.change())main()
Answer : Option D
Explanation :
The derived class method change() overrides the base class method.
Be The First To Comment