t407.py 355 B

123456789101112131415161718192021
  1. class A(object):
  2. def __init__(self):
  3. self.a = 1
  4. self.b = 2
  5. self.c = 3
  6. class B(A):
  7. def __init__(self):
  8. A.__init__(self)
  9. self.d = 4
  10. class C(B):
  11. def __init__(self):
  12. B.__init__(self)
  13. def __dir__(self):
  14. return ['a','b','c','d']
  15. print dir(A())
  16. print dir(B())
  17. print dir(C())