Method Overriding:

  • It allows a subclass to provide a specific implementation of a method that is already defined in its superclass.
  • Example: A subclass Square can override the area() method inherited from its superclass Shape.

Comments

Leave a Reply

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