Python Add Class Method
နည်းလမ်းများထည့်ပါ။
ဥပမာ
အတန်း welcome
သို့
ခေါ်သည့်နည်းလမ်းကို ထည့်ပါ -Student
class Student(Person):
def __init__(self, fname, lname, year):
super().__init__(fname, lname)
self.graduationyear
= year
def welcome(self):
print("Welcome",
self.firstname, self.lastname, "to the class of", self.graduationyear)
parent class ရှိ function တစ်ခုကဲ့သို့ နာမည်တူ ကလေးအတန်းတွင် method တစ်ခုကို ထည့်ပါက၊ parent method ၏ အမွေဆက်ခံမှုကို လွှမ်းမိုးသွားပါမည်။