Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!usc!apple!bbn.com!nic!chaos.cs.brandeis.edu!chaos!phils From: phils@chaos.cs.brandeis.edu (Phil Shapiro) Newsgroups: comp.sys.mac.programmer Subject: Re: Casting in Think C Message-ID: Date: 6 Dec 90 14:41:12 GMT References: <6167@munnari.oz.au> <3028@skye.cs.ed.ac.uk> Sender: @chaos.cs.brandeis.edu Organization: Symantec Corp. Lines: 24 In-Reply-To: nick@cs.edinburgh.ac.uk's message of 5 Dec 90 12:30:46 GMT In article <3028@skye.cs.ed.ac.uk> nick@cs.edinburgh.ac.uk (Nick Rothwell) writes: In article <6167@munnari.oz.au>, caw@munnari.oz.au (Chris Wright) writes: > new is meant to "automatically assign a class to the newly > created object" Now, I've never understood what this kind of thing means, ditto for Bless() and all the rest. Presumably it does something automagical to the method dispatcher. Anybody care to comment what "the class of an object" actually means (as opposed to the static type of the object pointer)? The only part of an object (in ThC) that indicates its class type is the "Class ID". This is a word-sized number assigned to each class at compile time. When you call a method, the method dispatcher, __msg(), uses this number to determine which "method table" to use. So all bless() has to do is change this number, and voila! It will behave just as the bless()'d class, since it's using that class' method table. -phil -- Phil Shapiro Technical Support Analyst Language Products Group Symantec Corporation Internet: phils@chaos.cs.brandeis.edu