Subject: PHP

Polymorphism

  • Create an interface Shape with a method calculateArea().
  • Implement the interface in classes Circle and Rectangle with their respective formulas for area.
  • Instantiate the classes and call calculateArea() for each.

Select file or drag and drop

PNG, JPG, SVG

Preview