Skip to content

Commit

Permalink
return phone class
Browse files Browse the repository at this point in the history
  • Loading branch information
RedMarshall37 committed Nov 9, 2023
1 parent 75c060a commit b57735a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions rpgsaga/saga/src/phone.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export class Phone {
private aYear: number;
phoneNumber: string;

static phoneCount = 0;

constructor(number: string, year: number, public name?: string) {
Phone.phoneCount += 1;
this.phoneNumber = number;
this.year = year;
this.name = name;
}

call(number: string) {
console.log(`Making a call from ${this.phoneNumber} to ${number}`);
}
endCall() {
console.log('Ending call');
}

set year(year: number) {
this.aYear = year >= 1900 && year < 2023 ? year : this.aYear ?? 1900;
}

get year(): number {
return this.aYear;
}
}

0 comments on commit b57735a

Please sign in to comment.