【python】极简教程16-面向对象编程

16.1 对象和方法

类可以定义方法,方法是与类关联的函数。通过 def 关键字定义方法,第一个参数通常为 self,表示对象本身。

示例代码:

class Point:
    def __init__(self, x=0, y=0):
    

猜你喜欢

转载自blog.csdn.net/weixin_41697242/article/details/143305418