You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
8
8
9
-
## 属性
9
+
## Attributes
10
10
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:
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`.
21
21
22
-
## 方法
22
+
## Method
23
23
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:
25
25
26
26
```mcfpp
27
27
class A{
@@ -31,7 +31,7 @@ class A{
31
31
}
32
32
```
33
33
34
-
在方法中使用`this`关键字可以访问对象的属性。例如:
34
+
Use keyword `this` can access the attributes of the object,such as:
0 commit comments