修正定义类示例代码
This commit is contained in:
parent
43c147dad1
commit
aca4779f04
|
|
@ -44,7 +44,7 @@ class Student(object):
|
||||||
if self.age < 18:
|
if self.age < 18:
|
||||||
print('%s只能观看《熊出没》.' % self.name)
|
print('%s只能观看《熊出没》.' % self.name)
|
||||||
else:
|
else:
|
||||||
print('%s正在观看岛国爱情动作片.' % self.name
|
print('%s正在观看岛国爱情动作片.' % self.name)
|
||||||
```
|
```
|
||||||
|
|
||||||
> **说明**:写在类中的函数,我们通常称之为(对象的)方法,这些方法就是对象可以接收的消息。
|
> **说明**:写在类中的函数,我们通常称之为(对象的)方法,这些方法就是对象可以接收的消息。
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue