面试讲解1
2018-04-19 本文已影响9人
特力独行的猪
static method (静态方法): 静态方法放到一个类里面去定义,可以没有参数
class method(类方法) :
实例方法通过实例调用(实例方法只能通过对象名调用),
类方法通过类名调用,也可以通过对象名进行调用,对一个类属性进行修改的时候用到类方法, 参数是cls
@static method 继承方法
@class method 类方法

static method (静态方法): 静态方法放到一个类里面去定义,可以没有参数
class method(类方法) :
实例方法通过实例调用(实例方法只能通过对象名调用),
类方法通过类名调用,也可以通过对象名进行调用,对一个类属性进行修改的时候用到类方法, 参数是cls
@static method 继承方法
@class method 类方法