jakt
jakt copied to clipboard
Inheritance
Classes and structs should be allowed to inherit from other classes and structs respectively.
class Animal {
}
class CatDog: Animal {
}
struct Sport {
}
struct Football: Sport {
}
Note that a struct
can't inherit from a class
and vice versa, as that would break the reference counting ownership model.
What should syntax for multiple inheritance look like?
What should syntax for multiple inheritance look like?
Good question! I would like to explore if we can avoid multiple inheritance and instead express interfaces/protocols/traits using a separate mechanism. :^)
I know it's very very early but I hope to see soon some proper light RFCs so some thought goes into these and a public roadmap. Very interested how this will evolve.
Great input!
Dart uses mixins, a concept which lets you add features to a class without using multiple inheritance like explained in this article.
If you are allowing inheritance, please consider adding super calls in the constructor and avoid having to call the super constructor explicitly, as was just announced in Dart 2.17 :)