Tuesday, May 23, 2017

You can't use super outside of a constructor in TypeScript.

If you just call super(); there (the constructor) it should call the parent's constructor. You may call a parent's constructor with parameters too. But you cannot have Anaconda inherit from Animal and have its own Eat method which calls the Animal Eat method and then does some regurgitate mechanics.

 
 

Addendum 8/1/2017: This isn't true. There is just a different shape to things. Also, super implementations in a TypeScript constructor need to be called first before other lines of code in the constructor.

No comments:

Post a Comment