上篇讲过的 基本数据类型来定义变量的类型,那么interface 接口用来定义对象的类型;
1.interface
- 接口一般首字母大写
- 约束对象 要与接口形状保持一致
1 | interface Person { |
2.可选属性
1 | interface Person { |
3.任意属性
1 | interface Person { |
4.只读属性
1 | interface Person { |
上篇讲过的 基本数据类型来定义变量的类型,那么interface 接口用来定义对象的类型;
1.interface
1 | interface Person { |
2.可选属性
1 | interface Person { |
3.任意属性
1 | interface Person { |
4.只读属性
1 | interface Person { |