emacs.d/clones/lisp/www.cs.cmu.edu/Groups/AI/html/cltl/clm/node305.html

51 lines
2.9 KiB
HTML
Raw Normal View History

2022-08-26 19:11:35 +02:00
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
<!Converted with LaTeX2HTML 0.6.5 (Tue Nov 15 1994) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
<HEAD>
<TITLE>28.1.11. Changing the Class of an Instance</TITLE>
</HEAD>
<BODY>
<meta name="description" value=" Changing the Class of an Instance">
<meta name="keywords" value="clm">
<meta name="resource-type" value="document">
<meta name="distribution" value="global">
<P>
<b>Common Lisp the Language, 2nd Edition</b>
<BR> <HR><A NAME=tex2html5467 HREF="node306.html"><IMG ALIGN=BOTTOM ALT="next" SRC="icons/next_motif.gif"></A> <A NAME=tex2html5465 HREF="node261.html"><IMG ALIGN=BOTTOM ALT="up" SRC="icons/up_motif.gif"></A> <A NAME=tex2html5459 HREF="node304.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="icons/previous_motif.gif"></A> <A NAME=tex2html5469 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="icons/contents_motif.gif"></A> <A NAME=tex2html5470 HREF="index.html"><IMG ALIGN=BOTTOM ALT="index" SRC="icons/index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME=tex2html5468 HREF="node306.html"> Modifying the Structure </A>
<B>Up:</B> <A NAME=tex2html5466 HREF="node261.html"> Programmer Interface Concepts</A>
<B> Previous:</B> <A NAME=tex2html5460 HREF="node304.html"> Extensions</A>
<HR> <P>
<H2><A NAME=SECTION0032111000000000000000>28.1.11. Changing the Class of an Instance</A></H2>
<P>
<img align=bottom alt="change_begin" src="gif/change_begin.gif"><br>
<A NAME=ChangingtheClassofanInstanceSECTION>The</A>
function <tt>change-class</tt> can be used to change the class of an
instance from its current class, <IMG ALIGN=BOTTOM ALT="" SRC="_24769_tex2html_wrap43627.gif">, to a
different class, <IMG ALIGN=BOTTOM ALT="" SRC="_24769_tex2html_wrap43629.gif">; it changes the
structure of the instance to conform to the definition of the class
<IMG ALIGN=BOTTOM ALT="" SRC="_24769_tex2html_wrap43629.gif">.
<P>
Note that changing the class of an instance may cause slots to be
added or deleted.
<P>
When <tt>change-class</tt> is invoked on an instance, a two-step updating
process takes place. The first step modifies the structure of
the instance by adding new local slots and discarding local slots that
are not specified in the new version of the instance. The second step
initializes the newly added local slots and performs any other
user-defined actions. These steps are further described in the
following two sections.
<br><img align=bottom alt="change_end" src="gif/change_end.gif">
<P>
<HR>
<UL>
<LI> <A NAME=tex2html5471 HREF="node306.html#SECTION0032111100000000000000"> Modifying the Structure of an Instance</A>
<LI> <A NAME=tex2html5472 HREF="node307.html#SECTION0032111200000000000000"> Initializing Newly Added Local Slots</A>
<LI> <A NAME=tex2html5473 HREF="node308.html#SECTION0032111300000000000000"> Customizing the Change of Class of an Instance</A>
</UL>
<HR>
<P><ADDRESS>
AI.Repository@cs.cmu.edu
</ADDRESS>
</BODY>