Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
9 Cards in this Set
- Front
- Back
What does "class Child extends Parent" mean? |
That means |
|
What is the field initialization order for base/derived class? |
The class field is initialized:Before constructor for the base class (that doesn’t extend anything), Immediately after super() for the derived class. |
|
How to call a method from parent class? |
super.method(...) |
|
What effect has constructor internal property [[ConstructorKind]] with value "derived" |
That label affects its behavior with new.When a regular function is executed with new, it creates an empty object and assigns it to this.But when a derived constructor runs, it doesn’t do this. It expects the parent constructor to do this job.So a derived constructor must call super in order to execute its parent (base) constructor, otherwise the object for this won’t be created. And we’ll get an error. |
|
if a class extends another class and has no constructor, then the following “empty” constructor is generated: |
class Rabbit extends Animal { // generated for extending classes without own constructors constructor(...args) { super(...args); }} |
|
What should constructors in inheriting classes must call first? |
Constructors in inheriting classes must call super(...), and (!) do it before using this. |
|
Which field values does always use parent constructor? |
the parent constructor always uses its own field value, not the overridden one |
|
animal.eat .[[HomeObject]] == ? |
animal |
|
What syntax should be used for objects in order that calling super.method() was working? |
for objects, methods must be specified exactly as method(), not as "method: function()" |