Skip to content

Commit 363424b

Browse files
committed
2 parents 461bfa4 + 6e1544c commit 363424b

File tree

3 files changed

+40
-40
lines changed

3 files changed

+40
-40
lines changed

docs/en/quickstart/05class/02member.md

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

5-
# 类的成员
5+
# Member of class
66

7-
和Java类似,在MCFPP中,类的成员包括属性和方法。属性是类的数据成员,用来存储对象的数据;方法是类的函数成员,用来操作对象的数据。类的成员可以通过`.`操作符来访问。
7+
Similar to Java, in MCFPP, members of class include attributes and methods. Attributes are the data members, used to store the data of the object; methods are the function of class member, used to operate the data of the object. Member of class can access by `.` operator.
88

9-
## 属性
9+
## Attributes
1010

11-
属性是类的数据成员,用来存储对象的数据。属性的定义语法如下:
11+
Attributes are the data member of class, used to store the data of a object. The grammar to define attributes is shown below:
1212

1313
```mcfpp
1414
class A{
@@ -17,11 +17,11 @@ class A{
1717
}
1818
```
1919

20-
上述代码定义了一个类`A`,它有两个属性`a``b``a`是一个整数类型的属性,没有初始化;`b`是一个整数类型的属性,初始化为`5`
20+
The code before defined a class `A`, it has two attributes `a` and `b`. `a` is a integer attribute, not initialized; `b` is a integer attribute, initialized as `5`.
2121

22-
## 方法
22+
## Method
2323

24-
方法是类的函数成员,用来操作对象的数据。方法的定义语法如下:
24+
Methods are the function member of class, used to operate the data of the object. The grammar to define a method is shown below:
2525

2626
```mcfpp
2727
class A{
@@ -31,7 +31,7 @@ class A{
3131
}
3232
```
3333

34-
在方法中使用`this`关键字可以访问对象的属性。例如:
34+
Use keyword `this` can access the attributes of the object,such as:
3535

3636
```mcfpp
3737
class A{
@@ -42,13 +42,13 @@ class A{
4242
}
4343
```
4444

45-
## 访问控制
45+
## Access control
4646

47-
MCFPP中,类的成员可以使用`public``protected``private`关键字来控制访问权限。默认情况下,类的成员是`private`的。
47+
In MCFPP, members of class can use keywords `public`, `protected` and `private` to control the access rights. Default, members of class are `private`.
4848

49-
- `public`公有的,可以被外部访问。
50-
- `protected`受保护的,可以被子类访问。
51-
- `private`私有的,只能在类的内部访问。
49+
- `public`public, accessible to outside.
50+
- `protected`protected, accessible to subclasses.
51+
- `private`private, only can access in the class.
5252

5353
```mcfpp
5454
class A{
@@ -59,16 +59,16 @@ class A{
5959
6060
class B: A{
6161
void test(){
62-
a = 1; #合法
63-
b = 2; #合法
64-
c = 3; #编译错误
62+
a = 1; # Allowed
63+
b = 2; # Allowed
64+
c = 3; # Error
6565
}
6666
}
6767
6868
func test(){
6969
A obj = new A();
70-
obj.a = 1; #合法
71-
obj.b = 2; #编译错误
72-
obj.c = 3; #编译错误
70+
obj.a = 1; # Allowed
71+
obj.b = 2; # Error
72+
obj.c = 3; # Error
7373
}
7474
```

docs/en/quickstart/05class/03inheritance-abstract.md

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

5-
# 继承和抽象
5+
# Inheritance and abstraction
66

7-
MCFPP中,类支持继承和抽象。继承是指一个类可以派生出一个或多个子类,子类可以继承父类的属性和方法。抽象是指一个类可以定义抽象方法,子类必须实现这些抽象方法。
7+
In MCFPP, class support supports Inheritance and abstraction. Inheritance means a class can derive one or many subclasses, subclasses can inherit parent class’s attributes and methods. Abstraction means a class can define abstract function, subclasses must achieve those abstract functions.
88

9-
## 继承
9+
## Inheritance
1010

11-
继承是指一个类可以派生出一个或多个子类,子类可以继承父类的属性和方法。继承的语法如下:
11+
Inheritance means a class can derive one or many subclasses, subclasses can inherit parent class’s attributes and methods. The grammar of inheritance is shown below:
1212

1313
```mcfpp
1414
class Parent{
@@ -28,11 +28,11 @@ class Child: Parent{
2828
}
2929
```
3030

31-
使用`:`关键字可以声明一个类继承自另一个类。利用`super`关键字,子类可以访问父类的属性和方法。使用`protected`关键字可以声明受保护的属性,子类可以访问父类的受保护属性。使用`override`关键字可以重写父类的方法。
31+
Use keyword `:` can declare a class is inherited from another class. Use keyword `super`, subclasses can visit parent class’s attributes and methods. Keyword `protected` can declare the protected attributes, subclasses can visit the protected attributes of parent class. Use keyword `override` can rewrite parent class’s method.
3232

33-
## 抽象
33+
## Abstraction
3434

35-
一个类可以定义抽象方法,子类必须实现这些抽象方法。抽象方法没有方法体,只有方法签名。抽象方法的定义语法如下:
35+
A class can define abstract methods, subclasses must achieve those abstract methods. Abstract methods have no method body,only have method abstraction. The grammar to define a abstract method is shown below:
3636

3737
```mcfpp
3838
abstract class A{
@@ -46,4 +46,4 @@ class B: A{
4646
}
4747
```
4848

49-
使用`abstract`关键字可以声明一个抽象类或一个抽象方法。抽象类的子类必须实现抽象方法,否则会编译错误。
49+
Use keyword `abstract`can define an abstract class or an abstract method. The subclass of abstract class must achieve the abstract method, else there’ll be compilation error.

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)