是“界面"吗?从 Dart 中删除了关键字? [英] Was the "interface" keyword removed from Dart?

查看:22
本文介绍了是“界面"吗?从 Dart 中删除了关键字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以肯定的是,Dart 是否已经删除了显式定义 interface 现在支持通过 abstract 隐式定义它?

Just to be sure, has Dart removed explicitly defining an interface now in favor of implicitly defining it via abstract?

我在 Dart 和接口隔离原则中看到它,但是我还发现很多内容还是引用了显式定义,比如Dart中什么时候使用接口?

I see it mentioned in Dart and Interface Segregation Principle, however I'm also finding a lot of content still referencing the explicit definition, such as When to use interfaces in Dart?

推荐答案

是的.从 Dart 中删除了 interface 关键字.相反,所有类都有隐式接口.所以如果你想定义一个接口,你可以改用抽象类.

Yes. The interface keyword was removed from Dart. Instead all classes have implicit interfaces. So if you want to define an interface you can use an abstract class instead.

请参阅 2012 年关于消除 interface 关键字的博文.

See this blog post from 2012 about eliminating the interface keyword.

这篇关于是“界面"吗?从 Dart 中删除了关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆