Skip to content

Commit

Permalink
completed namespace topics
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahsan2001 committed Aug 12, 2023
1 parent b796960 commit 5d865f7
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Namespaces/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/// <reference path="./utils.ts" />
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var App;
(function (App) {
var Detail = /** @class */ (function (_super) {
__extends(Detail, _super);
function Detail() {
return _super !== null && _super.apply(this, arguments) || this;
}
Detail.prototype.getName = function () {
console.log("name is ".concat(this.name));
};
Detail.prototype.bio = function () {
return "Name: ".concat(this.getName(), " ");
};
return Detail;
}(Bio.Name));
App.Detail = Detail;
var a = new App.Detail("Ahsan");
console.log(a.bio());
})(App || (App = {}));
19 changes: 19 additions & 0 deletions Namespaces/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/// <reference path="./utils.ts" />

namespace App {

export class Detail extends Bio.Name implements Bio.Data {

getName() {
console.log(`name is ${this.name}`)
}


bio(): string {
return `Name: ${this.getName()} `;
}
}

const a = new App.Detail("Ahsan");
console.log(a.bio());
}
30 changes: 30 additions & 0 deletions Namespaces/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
var Bio;
(function (Bio) {
var Name = /** @class */ (function () {
function Name(name) {
this.name = name;
}
return Name;
}());
Bio.Name = Name;
var FatherName = /** @class */ (function () {
function FatherName(name) {
this.name = name;
}
FatherName.prototype.getFatherName = function () {
console.log("father name is ".concat(this.name));
};
return FatherName;
}());
Bio.FatherName = FatherName;
var Age = /** @class */ (function () {
function Age(age) {
this.age = age;
}
Age.prototype.getAge = function () {
console.log("age is ".concat(this.age));
};
return Age;
}());
Bio.Age = Age;
})(Bio || (Bio = {}));
43 changes: 43 additions & 0 deletions Namespaces/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

namespace Bio {
export class Name {
protected name: string;

constructor (name: string){
this.name = name
}


}


export class FatherName {
protected name: string;

constructor (name: string){
this.name = name
}

getFatherName() {
console.log(`father name is ${this.name}`)
}
}

export class Age {
protected age: number;

constructor (age: number){
this.age = age
}

getAge() {
console.log(`age is ${this.age}`)
}
}


export interface Data {
bio(): string;
}

}

0 comments on commit 5d865f7

Please sign in to comment.