What is the primary reason to use method overriding in object-oriented programming?

  • To create a new method
  • To extend a class's functionality
  • To hide a method's implementation
  • To improve code readability
The primary reason to use method overriding is to hide a method's implementation in the base class and provide a specialized implementation in the derived class. This allows for polymorphism and abstraction.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *