我想撰寫自己的Map課程。MapBase并MapMixin有類似的檔案。我應該使用哪一個來撰寫我自己的Map課程?為什么?
我知道MapBase有更多的功能,因為它實作了MapMixin. 但是,中的函式MapBase似乎并不重要,因為它的所有函式都是static.
...
/// A basic `Map` class can be implemented by extending this class and
/// implementing `keys`, `operator[]`, `operator[]=`, `remove` and `clear`.
/// The remaining operations are implemented in terms of these five.
...
abstract class MapBase<K, V> extends MapMixin<K, V> {
...
/// A basic `Map` class can be implemented by mixin in this class and
/// implementing `keys`, `operator[]`, `operator[]=`, `remove` and `clear`.
/// The remaining operations are implemented in terms of these five.
...
abstract class MapMixin<K, V> implements Map<K, V> {
uj5u.com熱心網友回復:
這真的不要緊。mixin 的優點是你可以在你的類中包含多個 mixin,而你只能從一個類擴展。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/410664.html
標籤:
下一篇:從Dart隔離中捕獲例外
