TS2715
error TS2715: Abstract property ‘name’ in class ‘Animal’ cannot be accessed in the constructor.
Broken Code ❌
1 |
|
Fixed Code ✔️
The name
member of the abstract Animal
class is abstract
, so we have to define it ourselves in the derived class Dog
. Because name
has no access modifier, it is public
by default which means that our Dog
class has to implement it with a public
visibility:
1 |
|