Thursday, October 29, 2015

inheritance in python

 
http://www.dotnetperls.com/class-python 
 
 
class A:
    def width(self):
        print("a, width called")

class B(A):
    def size(self):
        print("b, size called")

# Create new class instance.
b = B()
# Call method on B.
b.size()
# Call method from base class.
b.width()

No comments:

Post a Comment