swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possible to "promote" an object from one class to another?


From: Paul Johnson
Subject: Possible to "promote" an object from one class to another?
Date: Thu, 06 May 1999 17:14:15 -0500

Suppose one class  Private with methods meth1,meth2 and variables A,B,C.
exists.

There is a subclass of this class, Sargent, which adds meth3, meth4, and
variables D,E,F.

Suppose in my model of life in a Hindu world (not really, but it spices
up the story) there is an object of Private type who achieves some goal
and then needs to become a Sargent.

Is there an automagical way to say "aPrivate you are now of class
Sargent. Keep your IVars and take on the properties of this class
Sargent"?

I understand that I can write methods that copy the data from variables
A,B,C in aPrivate into a new object aSargent and then drop aPrivate.
But that seems so unfun!  And if there are a lot of variables, that is
tedious.  (And since some of the variables are objects and array
pointers, the copyIVars method is not what I'm looking for.)

The more I think about it, the more I think it won't work, but I'm
asking just for the fun of it.

--
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700




                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]