阅读背景:

python构造函数

来源:互联网 
#   面向对象
#   有意义的面向对象的代码
#   类 = 面向对象
#   实例化
#   类的最基本的作用:封装代码
#   类和对象    类就像是一个模板,可以产生很多对象
class Student():
    name = ''
    age = 0
    def __init__(self):
        #   它是构造函数
        print('student')
    #行为     与   特征
    def do_homework(self):
        print('homework')



 #  调用类下面的函数
student1 = Student()
student2 = Student()
student3 = Student()
# print(id(student1))
# print(id(student2))
# print(id(student3))
#   面向对象
#   有意义的面向对象的代码
#   类 = 面向对象
#  



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: