Robert Dober
3/28/2006 8:50:00 AM
On 3/27/06, parisnight@gmail.com <parisnight@gmail.com> wrote:
>
> Passing in the parent instance to the child is a nice approach. In the
> end they still seem like separate entities though. That is, the parent
> is an object that the child can look at but the child hasn't actually
> become the parent. I'd like the child to become the parent including
> all its previous attributes, good or otherwise.
I am afraid that is not possible, remember that you have only a reference to
an object
changing the class of an existing object does not seem possible to me, but
maybe I am wrong, well I would be happy to be wrong BTW.
You read a header and it says, I'm a shape at position (4,5). So you
> instantiate a shape at position (4,5). Now you read further and it
> says it is a square. You'd now like the shape to change its class to
> become a square with its additional attributes.
Maybe I am caught in the Ruby Object Model paradigm, maybe we should forget
about objects and do our own design, seems a long shot to me though. I
noticed only *now* that you did not use classes but modules, why not,
interesting!
Nevertheless I still see the hurdle of an object not beeing able to change
its class, you can, however act on an object by defining instance variables
and methods as you read on and get more specific information.
Too bad I do not have enough time, seems quite interresting.
Cheers
Robert
>
>
>
>
--
Deux choses sont infinies : l'univers et la bêtise humaine ; en ce qui
concerne l'univers, je n'en ai pas acquis la certitude absolue.
- Albert Einstein