Skip to content

Commit 4cad956

Browse files
authored
Merge branch 'MinecraftFunctionPlusPlus:main' into main
2 parents 7096b9c + db780ae commit 4cad956

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

docs/en/quickstart/05class/01define-and-instantiate.md

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

5-
# 类的定义和实例化
5+
# The instantiate and define of class
66

77
```mcfpp
88
class Person{
@@ -26,33 +26,33 @@ class Person{
2626
```
2727

2828

29-
## 类的定义
29+
## Define of class
3030

31-
作为一个面向对象的编程语言,MCFPP有完善的面向对象的语法和功能。它的语法和Java/C#的语法非常相似,所以,如果你有相关的基础的话,你应该可以很轻松地上手。
31+
As a OOP(object oriented programming) language, MCFPP have complete OOP grammar and function. Its grammar is really similar with Java/C#. So, if you have the basic knowledge, you can learn it very easily.
3232

33-
在MCFPP中,可以使用`class`关键字来声明一个类:
33+
In MCFPP, you can use keyword `class` to define a class:
3434

3535
```mcfpp
3636
class ClassName{
37-
#类体
37+
# Class body
3838
#...
3939
}
4040
```
4141

42-
其中,`ClassName`是类的名字。在MCFPP中,类的名字必须以大写字母开头。而紧随其后的花括号中的内容则是类体,包含了类的成员变量和成员函数,以及它的构造方法等等。是吧,和Java/C#是一样的。
42+
In it, `ClassName` is the name of the class. In MCFPP, the name of a class must start with an upper letter. The big parentheses followed that is the class body, including the member variable and member function, also the constructor and so on. Yes, the same as Java/C#.
4343

44-
## 类的实例化
44+
## Instantiate of class
4545

46-
一般情况下,你可以使用`ClassName(参数列表)`来创建一个对象的实例。比如本篇开头的示例`Person`类可以用`Person p = Person("Alumopper",16)`来创建。在MCFPP中,你并不需要`new`关键字。它被省略掉了。
46+
Often, you can use `ClassName(parameter list )` to create a instantiation of an object. Such as the example `Person` class in the start of this article, you can create by `Person p = Person("Alumopper",16)`. In MCFPP, you don’t need keyword `new`. It’s ignored.
4747

48-
## 类的初始化器<Badge type="tip" text="未来特性" />
48+
## Object Initializer <Badge type="tip" text="Future feature" />
4949

50-
在创建类的时候,你可以使用类初始化器来对类的某些成员变量初始化,例如对于上文中的`Person`,有:
50+
When you create a class, you can use object Initializer to Instantiate some members of the class, such as the person shows before `Person`, you have:
5151

5252
```mcfpp
5353
Person p = Person("Alumopper",16){
54-
sex = ""
54+
sex = "F"
5555
};
5656
```
5757

58-
这样,`p``sex`成员变量就被初始化为`"女"`了。
58+
So the`sex` of member variable `p` will be instantiate as `"F"`.

0 commit comments

Comments
 (0)