
上QQ阅读APP看书,第一时间看更新
Objects and classes
The starting point of OOP, objects, are instances of defined classes. In Dart, as has already been pointed out, everything is an object, that is, every value we can store in a variable is an instance of a class. Besides that, all objects also extend the Object class, directly or indirectly:
- Dart classes can have both instance members (methods and fields) and class members (static methods and fields).
- Dart classes do not support constructor overloading, but you can use the flexible function argument specifications from the language (optional, positional, and named) to provide different ways to instantiate a class. Also, you can have named constructors to define alternatives.