You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
abstractclassMachine{constructor(publicmanufacturer: string){}// An abstract class can define methods of its own, or...summary(): string{return`${this.manufacturer} makes this machine.`;}// Require inheriting classes to implement methodsabstractmoreInfo(): string;}classCarextendsMachine{constructor(manufacturer: string,publicposition: number,protectedspeed: number){super(manufacturer);}move(){this.position+=this.speed;}moreInfo(){return`This is a car located at ${this.position} and going ${this.speed}mph!`;}}letmyCar=newCar("Konda",30,70);myCar.move();// position is now 80console.log(myCar.summary());// prints "Konda makes this machine."console.log(myCar.moreInfo());// prints "This is a car located at 80 and going 70mph!"