packages/babel-plugin-proposal-class-properties/test/fixtures/private/derived/exec.js
raw| 1 | class Foo { |
| 2 | #prop = "foo"; |
| 3 | |
| 4 | foo() { |
| 5 | return this.#prop; |
| 6 | } |
| 7 | } |
| 8 | |
| 9 | class Bar extends Foo { |
| 10 | #prop = "bar"; |
| 11 | |
| 12 | bar() { |
| 13 | return this.#prop; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | const f = new Foo; |
| 18 | expect(f.foo()).toBe("foo"); |
| 19 | |
| 20 | const b = new Bar; |
| 21 | expect(b.foo()).toBe("foo"); |
| 22 | expect(b.bar()).toBe("bar"); |