• 2022-05-31
    以下类方法定义正确的是()
    A: class Student: fav=("唱歌","跳舞","绘画") def showFav(cls): for item in cls.fav: print(item)
    B: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(cls): for item in fav: print(item)
    C: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(cls): for item in cls.fav: print(item)
    D: class Student: fav=("唱歌","跳舞","绘画") @classmethod def showFav(): for item in fav: print(item)
  • 举一反三