Virtual function in derived class is called : Class Virtual « Class « Python






Virtual function in derived class is called

Virtual function in derived class is called


class Base:
    def greet(self, name): 
       print "Welcome ", name

class Sub(Base):
    def greet(self, name):
        print "Well Met and",
        Base.greet(self, name)


x = Sub()
x.greet('Alex')


           
       








Related examples in the same category

1.Override predefined functionOverride predefined function
2.Virtual function: extend method behaviourVirtual function: extend method behaviour
3.Virtual function in PythonVirtual function in Python
4.Virtual function in Python classVirtual function in Python class
5.Virtual function in two base classVirtual function in two base class