Overriding Method คือการแทนที่ของ method class แม่
โดยการสร้าง method ที่ class ลูก
ซึ่งให้มีชื่อ method เหมือนกับ method class แม่
รูปโค้ดใน โปรแกรม ผลลัพธ์ที่ได้ โค้ดที่ใช้ในการ run
โค้ด: เลือกทั้งหมด
class A:
def method (self):
print('calling A method')
class B(A):
def method (self):
print('calling B method')
c = B()
print('_______________')
c.method()
print('_______________')