-
Notifications
You must be signed in to change notification settings - Fork 0
/
classs.ts
35 lines (30 loc) · 855 Bytes
/
classs.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
class Person {
name: String;
age: Number;
address: String;
constructor(name: String, age: number, address: String) {
(this.name = name), (this.age = age), (this.address = address);
}
goToSleep(hr: number) {
return `${this.name} will sleep for ${hr}`;
}
}
// .......................
class Student extends Person {
constructor(name: String, age: number, address: String) {
super(name, age, address);
}
}
// .....................
class Teacher extends Person {
designation: String;
constructor(name: String, age: number, address: String, designation: String) {
super(name, age, address);
this.designation = designation;
}
takeClass(hr: number) {
return `${this.name} will Take class for ${hr}`;
}
}
const teacher1 = new Teacher("nizam", 24, "Comilla", "Teacher");
console.log(teacher1.goToSleep(10));