Dave Angel wrote:

Inside the __init__() method of Submarine, simply call the __init__() method of Craft, with appropriate parameters.

To elaborate on that a little, it looks like this:

  class Craft:

    def __init__(self, position):
      self.position = position


  class Submarine(Craft):

    def __init__(self, position, depth):
      Craft.__init__(self, position)
      self.depth = depth

Note the explicit 'self' passed to the __init__ method
of Craft. This is necessary because you are calling the
method's underlying function directly, bypassing the
magic which normally inserts 'self' automatically.

--
Greg
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to