What happens if the base class method is private, and you try to override it in a derived class?
- Compilation error
- The base class method is called
- The derived class method is overridden
- The derived class method is private
If the base class method is private, it cannot be overridden in the derived class. Attempting to do so will result in a compilation error, as private methods are not accessible outside the class.
Loading...
Related Quiz
- Which keyword is used to define a function in Python?
- Which keyword is specifically used to terminate a loop prematurely?
- In Python, what term is used when a function is defined inside another function?
- Which Python module would you use for measuring the performance of small code snippets?
- How can you invoke the method of a superclass from a subclass?