Quick actions

cmd+k|ctrl+k

Navigation

Languages

Python 3 对象:4

Snippet info

Language

Python

Visibility

public

Author

fenghestudio

Created

2019-11-24T07:49:42Z

Updated

2019-11-24T07:49:42Z

Live Demo
#!/usr/bin/python3

class Parent:        # 父类
   def myMethod(self):
      print ('Calling parent method')

class Child(Parent): # 子类
   def myMethod(self):
      print ('Calling child method')

c = Child()          # 创建子类对象实例
c.myMethod()         # 调用重写后的方法
INFO