Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Abstract class in js

class Employee
{
  constructor() {
    if(this.constructor == Employee){
    throw new Error(" Object of Abstract Class cannot be created");
    }
  }
  display() {
    	throw new Error("Abstract Method has no implementation");
    }
  }
  class Manager extends Employee
  {
    display(){
    //super.display();
    console.log("I am a Manager");
  }
}
Source by www.educba.com #
 
PREVIOUS NEXT
Tagged: #Abstract #class #js
ADD COMMENT
Topic
Name
6+4 =