This commit is contained in:
Nawaz Dhandala
2022-04-12 15:54:24 +01:00
parent e4514ae16a
commit 2e6574a47b
2 changed files with 41 additions and 3 deletions

View File

@@ -0,0 +1,38 @@
export default class Name {
private _title : string = '';
public get title() : string {
return this._title;
}
public set title(v : string) {
this._title = v;
}
private _name: string = '';
public get name(): string {
return this._name;
}
public set name(v: string) {
this._name = v;
}
constructor(name: string) {
this.name = name;
}
getFirstName() {
return this.name.split(' ')[0];
}
getLastName() {
return this.name.split(' ')[this.name.split(' ').length -1];
}
getMiddleName() {
return this.name.split(' ')[0];
}
toString(): string {
return this.name;
}
}

View File

@@ -6,12 +6,12 @@ export default class Port {
public get port(): PositiveNumber {
return this._port;
}
public set port (v: PositiveNumber) {
public set port(v: PositiveNumber) {
this._port = v;
}
constructor (port: number) {
if (port >= 0 && port <= 65535) {
constructor(port: number) {
if (port >= 0 && port <= 65535) {
this.port = new PositiveNumber(port);
} else {
throw new BadDataException(