|
| 1 | +"use strict"; |
| 2 | +var __extends = (this && this.__extends) || (function () { |
| 3 | + var extendStatics = function (d, b) { |
| 4 | + extendStatics = Object.setPrototypeOf || |
| 5 | + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || |
| 6 | + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; |
| 7 | + return extendStatics(d, b); |
| 8 | + }; |
| 9 | + return function (d, b) { |
| 10 | + if (typeof b !== "function" && b !== null) |
| 11 | + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); |
| 12 | + extendStatics(d, b); |
| 13 | + function __() { this.constructor = d; } |
| 14 | + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
| 15 | + }; |
| 16 | +})(); |
| 17 | +exports.__esModule = true; |
| 18 | +var Person = /** @class */ (function () { |
| 19 | + function Person(name) { |
| 20 | + this.name = name; |
| 21 | + } |
| 22 | + Person.prototype.greet = function () { |
| 23 | + console.log("Hello " + this.name); |
| 24 | + }; |
| 25 | + return Person; |
| 26 | +}()); |
| 27 | +var p1 = new Person("Ann Adams"); |
| 28 | +p1.greet(); |
| 29 | +var Employee = /** @class */ (function (_super) { |
| 30 | + __extends(Employee, _super); |
| 31 | + function Employee(name) { |
| 32 | + return _super.call(this, name) || this; |
| 33 | + } |
| 34 | + Employee.prototype.worksOn = function () { |
| 35 | + console.log(this.name + " works on many tasks."); |
| 36 | + }; |
| 37 | + return Employee; |
| 38 | +}(Person)); |
| 39 | +var p2 = new Employee("Mary Smith"); |
| 40 | +p2.greet(); |
| 41 | +p2.worksOn(); |
0 commit comments