-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass.ts
59 lines (47 loc) · 919 Bytes
/
class.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { Chatroom, Shop } from "./interface";
export class Empty { }
export class Customer { }
export class Custom extends Customer implements Chatroom, Shop {
connect(...args: [] | []) {
console.log('welcome~');
}
buy() {
console.log('buy successful');
}
}
export class Car {
drive(): void {
// hit the gas
}
}
export class Golfer {
drive(): void {
// hit the ball far
}
}
export class Animal {
public name: string;
public constructor(name: string) {
this.name = name;
}
}
export abstract class AnimalBase {
public name: string;
public constructor(name: string) {
this.name = name;
}
public abstract sayHi(): void;
}
export class Cat extends Animal {
public eat() {
console.log(`${this.name} is eating.`);
}
}
export class Sprite {
name: string = "";
x: number = 0;
y: number = 0;
constructor(name: string) {
this.name = name;
}
}