Derived class and deepcopy

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Philip Smith

    #1

    Derived class and deepcopy

    Hi

    If I derive a class (eg Matrix) from list I presume this implies the classic
    OOP 'is a' relation between the derived and super class.

    I therefore presume I can use a derived class in any context that I can use
    the superclass.

    In the given example I want to apply deepcopy() to the Matrix instance (on
    initialisation) to ensure that the list part is not affected by subsequent
    changes to the initialising list or Matrix but this gives me a string of
    errors (some of which imply I'm trying to copy the class rather than the
    instance).

    Anyone got any thoughts on this????

    Phil


  • Fredrik Lundh

    #2
    Re: Derived class and deepcopy

    Philip Smith wrote:
    [color=blue]
    > In the given example I want to apply deepcopy() to the Matrix instance (on initialisation) to
    > ensure that the list part is not affected by subsequent changes to the initialising list or Matrix
    > but this gives me a string of errors (some of which imply I'm trying to copy the class rather than
    > the instance).
    >
    > Anyone got any thoughts on this????[/color]

    where's the example? what errors do you get?

    </F>



    Comment

    Working...