I am reading the Dart documentation on The Dart type system and quite don't understand the example in the Use sound return types when overriding methods:
This is supposedly correct:
class HoneyBadger extends Animal {
@override
void chase(Animal a) { ... }
@override
HoneyBadger get parent => ...
}
but this isn't:
class Root extends Animal {
@override
void chase(Animal a) { ... }
@override
Root get parent => ...
}
But the examples are exactly the same - they both extends the Animal
class. What I am missing?
This got fixed and the page now has a correct example:
class HoneyBadger extends Animal {
@override
void chase(Animal a) { ... }
@override
Root get parent => ...
}