[root@zz python]# cat a1.py
# !/usr/bin/env python
# -*- coding: utf-8 -*-
class AddrBookEntry(object): ##类定义
def __init__(self,a,b): ##定义构造器
self.var1=a+9
self.var2=b+11
def updatePhone(self, num): # 定义方法
self.var3 = num +str(100)
return self.var3
class EmplAddrBookEntry(AddrBookEntry):
def __init__(self, x, y):
# 调用父类构造函数
super(EmplAddrBookEntry,self).__init__(11,22)
a=EmplAddrBookEntry(11,22)
print a
print type(a)
print dir(a)
print a.updatePhone('llll')
print a.var1
print a.var2
[root@zz python]# python a1.py
<__main__.EmplAddrBookEntry object at 0x7fc35091ad50>
['__class__', '__delattr__', '__dict__', '__doc__', '_