1

Suppose I have a class animal, with subclasses horse, duck, and rabbit. Suppose I use make-instance to make several objects of class animal. Much later, I discover, for each of these objects, that it's actually a horse, or a duck, or a rabbit. Is there a way to retype these objects? Simply creating new objects of the appropriate subtypes and copying over the data in all the slots, would be clumsy, because by this time such an object is already represented in lists which are in slots of yet other objects, and I'd have to go through those lists and replace the old objects with the new ones.

Keep the same old objects and subclassify them. Can I do this?

Rainer Joswig
  • 136,269
  • 10
  • 221
  • 346
Bill Evans at Mariposa
  • 3,590
  • 1
  • 18
  • 22

1 Answers1

2

CHANGE-CLASS, a standard Common Lisp function.

Rainer Joswig
  • 136,269
  • 10
  • 221
  • 346