Method Overriding

Method Overriding
πŸ‘¨β€πŸ’Ό Now let's add methods to our shape hierarchy. Each shape will override a method to provide its own implementation.
The Shape, Circle, and Rectangle classes from the previous exercise are already defined. You'll add and override the getArea() method.
🐨 Open
index.ts
and:
  1. Add a getArea() method to Shape that returns 0
  2. Override getArea() in Circle to return Ο€ Γ— radiusΒ²
  3. Override getArea() in Rectangle to return width Γ— height

Please set the playground first

Loading "Method Overriding"
Loading "Method Overriding"
Login to get access to the exclusive discord channel.
Loading Discord Posts