[Openmcl-devel] change objc class?

Bill St. Clair wws at clozure.com
Sat Feb 11 08:20:28 PST 2012


Never done it myself, but apparently it's possible, in a limited way,
nothing like CLOS change-class:

http://stackoverflow.com/posts/679866/revisions

obj->isa = [NewClass class];

This only changes the class that receives method calls for that
object; it doesn't change the object's layout in memory. Thus, this is
only really useful when you have a set of classes with the same ivars
(or one with a subset of the others') and you want to switch between
them.

-Bill

On Sat, Feb 11, 2012 at 11:15 AM, Arthur Cater <arthur.cater at ucd.ie> wrote:
> Is it possible to change the class of an objc instance?
>
> eg if I defined a subclass of ns-window, with no extra slots,
> could I make an existing window be of that subclass?
>
> Arthur
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel



More information about the Openmcl-devel mailing list