class ClassStudent {
// public name: string;
// public semester: string;
// public course: string;
private _name: string = '';
private _semester: string = '';
private _course: string = '';
//Getter method to return name of
public get showName() {
return `Name : ${this._name}\n The semester name :${this._semester}\n The course name :${this._course}`;
}
// Setter method to set the semester
public set setSemester(semesterName: string) {
this._semester = semesterName;
}
// Setter Method
public set setCourse(courseName: string) {
this._course = courseName;
}
}
// Access any property of the student class
let std = new ClassStudent();
// Getter call
let value = std.showName;
console.log(value);
// Setter call
std.setSemester = 'Summer 2024';
std.setCourse = 'Web Development';