Python面向对象编程-创建一个类

class Dog:
    attr_01 = '毛发'
    attr_02='尖牙'

    def __init__(self,name):
        self.name=name

    def eat(self):
        print('爱吃肉骨头')

    def info(self,i):
        print('i')
        print(self.name)
        print(self.attr_01)
        print(self.attr_02)

 

posted @ 2024-12-08 13:12  mafei666  阅读(12)  评论(0)    收藏  举报