in reply to Re: Instance data inheritance?
in thread Instance data inheritance?

If you have a case where MyClass::Item ISA MyClass, then you can rebless the object into the subclass. I'm using that technique right now on a project.
I must say that I had thought of using "real inheritance" by cloning the "parent instance" data (or some relevant portion of it) into the child objects - however it seeemed to me to be totally unacceptable in terms of data payload.

Now that you point it out, reblessing doesn't seem to be affected by this downside, yet I'm slightly concerned about it, from the conceptual poin of view since it conveys the impression of including data into the "item" objects that really doesn't belong to them (but they must have access to it).

Replies are listed 'Best First'.
Re^3: Instance data inheritance?
by herveus (Prior) on May 17, 2005 at 10:40 UTC
    Howdy!

    The objects are initially created as X, then serially reblessed into subclasses of X. Each subclass extends the state and behavior from there.

    yours,
    Michael
      Howdy!
      Fine thanks. (Except that I should have given an exam today, and -yet another time- I didn't!)
      The objects are initially created as X, then serially reblessed into subclasses of X. Each subclass extends the state and behavior from there.
      So far so fine - nothing unexpected or surprising! But then... I must apologize for maybe it's just me, but I'm not really sure which exact statement of mine you're addressing.