📜  如何在 python 代码示例中使用类

📅  最后修改于: 2022-03-11 14:45:30.422000             🧑  作者: Mango

代码示例6
class awwab(object):
    def __init__(self, name, age):
        self.name = name
        self.age = age
    
    def speak(self):
        print("Hello, my name is",self.name,"and I am",self.age,"years old!")
        
awwabasad = awwab("Awwab Asad", 11)
print(awwabasad.speak())