1.

Which of the following statements is true?(a) A non-private method in a superclass can be overridden(b) A subclass method can be overridden by the superclass(c) A private method in a superclass can be overridden(d) Overriding isn’t possible in PythonThe question was asked during an interview.My doubt stems from Polymorphism in portion Classes and Objects, Inheritance, Polymorphism, Encapsulation and Exception Handling of Python

Answer»

Right OPTION is (a) A non-private method in a superclass can be overridden

Explanation: A PUBLIC method in the base CLASS can be overridden by the same named method in the subclass.



Discussion

No Comment Found

Related InterviewSolutions