@sean9999/

so 41080980

JavaScript

No description

fork
loading
main.js
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
/**
 * re: http://stackoverflow.com/questions/41080980/javascript-inheritance-by-two-subclases
 * 
 * */

class First {
    constructor() {
        this.loc = '1';
    }
    test() {
        console.log('first', this.loc);
    }
}

class Second extends First {
    constructor() {
        super();
        this.loc = '2';
    }
    test() {
      console.log('second',this.loc);
      super.test();
    }
}

class Third extends Second {
    constructor() {
        super();
        this.loc = '3';
    }
    test() {
        console.log('third',this.loc);
        super.test();
    }
}

let t = new Third();
t.test();
Native Browser JavaScript