# !/usr/bin/env python
# -*- coding: utf-8 -*-
class Mama(object):#这是老的方法
def says(self,aa):
self.name=aa
return self.name
a=Mama()
print a
print type(a)
print a.says('hhh')
C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/mycompany/aaa/a6.py
<__main__.Mama object at 0x024872F0>
<class '__main__.Mama'>
hhh
Process finished with exit code 0
# !/usr/bin/env python
# -*- coding: utf-8 -*-
class Mama(object):#这是老的方法
def says(self,aa):
self.name=aa
return self.name
class Sister(Mama):
def says(self,aa):
self.name=aa
return self.name +'kk'
a=Sister()
print a
print type(a)
print a.says('hhh')
C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/mycompany/aaa/a6.py
<__main__.Sister object at 0x027973B0>
<class '__main__.Sister'>
hhhkk
Process finished with exit code 0
# !/usr/bin/env python
# -*- coding: utf-8 -*-
class Mama(object):#这是老的方法
def says(self,aa):
self.name=aa
return self.name
class Sister(Mama):
def says(self,aa):
super(Sister,self).says('ii')
return super(Sister,self).says(aa)
a=Sister()
print a
print type(a)
print a.says('hhh')
C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/mycompany/aaa/a6.py
<__main__.Sister object at 0x026C7350>
<class '__main__.Sister'>
hhh