Home  >  Q&A  >  body text

javascript - Still cannot access private functions of class after instantiation

After instantiating alarm, why can’t it access its private private functions findCache and addCache through .: alarm is shown in the figure

Instantiation and calling:

漂亮男人漂亮男人2642 days ago716

reply all(1)I'll reply

  • typecho

    typecho2017-06-26 10:59:48

    Didn’t you already say that this is a private function? How to access the private function? The official document is as follows:

    When a member is marked private, it cannot be accessed from outside of its containing class.

    https://www.typescriptlang.or...

    reply
    0
  • Cancelreply