> -----Opprinnelig melding----- > Fra: Wyss Clemens [mailto:WYS / helbling.ch] > Sendt: 27. april 2001 07:11 > Til: ruby-talk ML > Emne: [ruby-talk:14296] Re: how change instances class > > > "Henning VON ROSEN" <hvrosen / world-online.no> wrote in > <MABBIFGPDKFFOJPHLCLIAEHICCAA.hvrosen / world-online.no>: > >------=_NextPart_000_0000_01C0CE8E.75E08460 > >Sorry, din't find it in pickaxe: > > > >(1) How(if possible) can I change the value of the class attribute? > > ...what do you mean by "attribute"? sorry about inappropriate vocabulary. I imagined that, somewhere in the instance, there is variable referencing what class it belongs to. In Python it's a tuple hat can be replaced. I was asking if there is something similar in Ruby. So I suppose the answer is no, and I'd better open up GoF again... > >Say, that a instance at first is known as belonging to a fairly general > >class, and when we gather more information, it turns out to belong more > >precisely to a subclass. > > > ...sounds like applying the "strategy"-(or the "state"-) pattern (see > GoF-book) might be appropriate here. I'll look in to that pattern. Thanks! amike via Henning