Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Question regarding nested classes #71

Closed
billinghamj opened this issue Jan 13, 2018 · 1 comment
Closed

Question regarding nested classes #71

billinghamj opened this issue Jan 13, 2018 · 1 comment

Comments

@billinghamj
Copy link

Given a case where you have nested classes, and the "inner" class wants to access the private property of the "outer" class:

class A {
  #b;

  foo() {
    const self = this;

    console.log(self.#b); // this works

    class C {
      bar() {
        console.log(self.#b); // does this work?
      }
    }
  }
}

Would the above code work?

@littledan
Copy link
Member

Yes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants