#! /usr/bin/python
import math
class Class1:
def __init__(self, name='class1'):
self.name=name
def getName(self):
print self.name
class Class2(Class1):
def hello(self):
print 'class2 hello'
c1 = Class1('class 1')
c2 = Class2('class 2')
c1.getName()
c2.getName()
c2.hello()
Output:
class 1
class 2
class2 hello
No comments:
Post a Comment