Skip to content

Commit 7cd747e

Browse files
committed
Refactor property access modifiers
1 parent e777a3f commit 7cd747e

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed
Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
11
export default class Course {
2-
private _id: string;
3-
private _name: string;
4-
private _duration: string;
2+
readonly id: string;
3+
readonly name: string;
4+
readonly duration: string;
55

66
constructor(id: string, name: string, duration: string) {
7-
this._id = id;
8-
this._name = name;
9-
this._duration = duration;
10-
}
11-
12-
get id(): string {
13-
return this._id;
14-
}
15-
16-
get name(): string {
17-
return this._name;
18-
}
19-
20-
get duration(): string {
21-
return this._duration;
7+
this.id = id;
8+
this.name = name;
9+
this.duration = duration;
2210
}
2311
}

0 commit comments

Comments
 (0)