>
> class Snake extends Animal {
>>
>> constructor(name){
>>
>> super(name);
>>
>> }
>>
>> Another option here would be:
class Snake extends Animal {
// Using "new" ; )
new(name) : super(name) {}
};
Note the call to the super constructor before the body of the constructor.
This is similar to C#. The reason that we might want to go that way is
because if we wanted to have instance initializers in the class body (a
very common thing in class-based languages), then we'd want to maintain
this order:
1. Call superclass constructor
2. Execute instance property initializers in text order
3. Execute constructor body
kevin
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss