[root@localhost /]#
[root@localhost /]# cat cla.py
#!/bin/python
class zhu():
def __init__(self,chang,kuan,gao):
self.chang=chang
self.kuan=kuan
self.gao=gao
def tiji(self):
return self.chang*self.kuan*self.gao
if __name__=='__main__':
print("aaaaaaaaaa")
[root@localhost /]#
[root@localhost /]# cat class.py
#!/bin/python
import cla
class zlg(cla.zhu):
def __init__(self,chang,kuan,gao):
cla.zhu.__init__(self,chang,kuan,gao)
self.yanse=2
def area(self):
return self.chang*self.kuan*2+self.kuan*self.gao*2+self.chang*self.gao*2
haha=zlg(1,2,3)
print haha.yanse
print(haha.area())
print(haha.tiji())
[root@localhost /]#
[root@localhost /]#
阅读(18849) | 评论(0) | 转发(0) |