Derived class problem

Geiger Ho s997659 at ee.cuhk.edu.hk
Sun May 26 22:30:45 EDT 2002


Hi all,

  Consider,

class A:
  def method1(self):
      ...
      child = A()
      ...

class B(A):
  pass


  When I call B.method1(), I will create an A child. But this is not I
intend to do. I wanna create a B child. Can anyone tell me how I can
modify? I don't want to override method1 as this is a pretty big code.
Moreover is this problem a kind of Design Patterns?

  Thanks in advance.

Regards,
Geiger




More information about the Python-list mailing list