class Shape {
        constructor(x, y) {}
      }
      
      class Movable extends Shape {
        constructor(x, y) {
          super(x, y);
        }
      
        move(dx, dy) {
          this.x += dx;
          this.y += dy;
        }
      }
      
      Javascript language logo

      Inheritance Snippet

      ES6
      JavaScript recipes

      Example of class inheritance through a Shape example

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.