Skip to content

Commit fcb47dc

Browse files
authored
Translate 01define-and-implement.md
1 parent 38a0616 commit fcb47dc

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

docs/en/quickstart/06interface/01define-and-implement.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
lastUpdate: true
33
---
44

5-
# 定义和实现接口
5+
# Define and implement
66

7-
MCFPP中,可以使用`interface`关键字来声明一个接口。接口是一种抽象的数据类型,它定义了一组方法的签名,但没有具体的实现。类可以实现一个或多个接口,从而保证类具有接口中定义的方法。
7+
In MCFPP, can use keyword `interface` to declare an interface, interface is an abstract data type, it defines a group of function’s declaration, but have not achieved it. Class can achieve one or many interfaces, and make sure that class have the function defined in the interface.
88

9-
## 接口的声明
9+
## Define of interface
1010

11-
接口的声明语法如下:
11+
The grammar to define a interface is shown below:
1212

1313
```mcfpp
1414
interface InterfaceName{
@@ -18,27 +18,27 @@ interface InterfaceName{
1818
}
1919
```
2020

21-
接口中的方法只有方法签名,没有方法体。接口中的方法可以有多个,每个方法之间使用分号`;`分隔。接口中的方法一定都是抽象方法,但是不需要额外使用`abstract`关键字来声明
21+
There’s only declaration in the function of the interface, no function body. A interface can have many functions, each function separate by `;`. Functions in interface must be abstract function, don’t need to use keyword `abstract` to declare.
2222

23-
## 接口的实现
23+
## Achieve of interface
2424

25-
接口不能被实例化,但可以被类实现。
25+
Interface can’t be instancing, but can achieve by class.
2626

27-
类可以实现一个或多个接口。实现接口的类必须实现接口中定义的所有方法。实现接口的语法如下:
27+
Class can achieve one or many interfaces, the class that achieves interface must achieve all functions declared in the interface. The grammar of achieves a interface is shown below:
2828

2929
```mcfpp
3030
class ClassName: Interface1, Interface2, ...{
31-
#类的属性和方法
31+
# Attributes and functions of class
3232
...
3333
override func methodName(parameterList) -> returnType{
34-
#方法体
34+
# Function body
3535
}
3636
}
3737
```
3838

39-
## 接口的继承
39+
## Inherit of interface
4040

41-
接口也可以继承自其他接口。继承接口的语法如下:
41+
Interface also can inherit from other interfaces. The grammar of inherit a interface is shown:
4242

4343
```mcfpp
4444
interface Interface1{
@@ -50,4 +50,4 @@ interface Interface2: Interface1{
5050
}
5151
```
5252

53-
如果一个类实现了一个继承了其他接口的接口,那么这个类必须实现接口以及其继承接口中定义的全部方法。
53+
If a class achieve an interface that inherits from other interface, then the class must achieve all functions of the interface and its inherited interface.

0 commit comments

Comments
 (0)