在一个类实例化多个对象时,self的作用就是保证能够正确的访问你的实例化对象
例如
class Student():
def __init__(self, name, age):
self.name = name
self.age = age
a = Student("小明","28")
b = Student("小红","30")
在一个类实例化多个对象时,self的作用就是保证能够正确的访问你的实例化对象
例如
class Student():
def __init__(self, name, age):
self.name = name
self.age = age
a = Student("小明","28")
b = Student("小红","30")