Polymorphism - Method Overriding (Python Tutorial - Part 50)

preview_player
Показать описание

In this session, I have explained and practically demonstrated about Method Overriding in Python.
Рекомендации по теме
Комментарии
Автор

if we created object to parent class then, if we try to access Class A members then PVM will show the Class A properties.
class A:
A=5
def m1(self):
print("parent method")

class B(A):
A=10
def m1(self):
print("child method")

a=A()
print(a.A)
a.m1()
b=B()
print(b.A)
b.m1()

nareshab-xuou