September 2019
Beginner
512 pages
12h 52m
English
Dart does not have the interface keyword but does allow us to use interfaces in a subtly different way from what you may be used to. All class declarations are themselves interfaces. This means that, when you are defining a class in Dart, you are also defining an interface that may be implemented and not only extended by other classes. This is called implicit interfaces in the Dart world.
On this basis, our previous Person class is also a Person interface that could be implemented, instead of extended, by the Student class:
class Student implements Person { String nickName; @override String firstName; @override String lastName; Student(this.firstName, this.lastName, this.nickName); @override String get fullName => "$firstName $lastName"; ...Read now
Unlock full access