Created
October 22, 2016 17:46
-
-
Save gerlacdt/87098fb2440fd351f61b2a7116af81b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bar { | |
constructor() { | |
this.foo = "foo from Bar"; | |
} | |
fooFunc() { | |
return this.foo; | |
} | |
} | |
class Foo { | |
constructor (bar) { | |
this.bar = bar; | |
this.foo = "foo from Foo"; | |
} | |
fooFunc() { | |
return this.foo; | |
} | |
} | |
const bar = new Bar(); | |
const foo = new Foo(bar); | |
console.log('foo.fooFunc(): ' + foo.fooFunc()); // expected "foo from Foo" | |
console.log('foo.bar.fooFunc(): ' + foo.bar.fooFunc()); // expected "foo from Bar" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment