From -4850490554267755757 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,3b19a004e78de1c9 X-Google-Attributes: gidf78e5,public X-Google-ArrivalTime: 1994-03-07 01:34:06 PST Newsgroups: comp.std.c++ Path: gmd.de!newsserver.jvnc.net!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!decwrl!netcomsv!netcom.com!rfg From: rfg@netcom.com (Ronald F. Guilmette) Subject: Re: Standard for order of base-class specification? Message-ID: Organization: Netcom Online Communications Services (408-241-9760 login: guest) References: Date: Mon, 7 Mar 1994 09:34:06 GMT Lines: 29 In article holcomb@wg.com (Edgar Holcomb) writes: > >Hi, folks, > >Is it dangerous to assume the structure of an instance of a >class with multiple base classes based on the order in which >the base classes are specified? > >Recall that, given a class specified as > >class Derived : public BaseA, public BaseB >{}; > >an instance of Derived would contain a BaseA sub-object and >a BaseB sub-object. Is it safe to assume that, within the >Derived object, the BaseA sub-object will be at offset zero >and the BaseB sub-object will be at offset sizeof( BaseA )? I don't believe so. As a matter of fact, I don't believe that it is even defined whether the `BaseA' part is *below* the `BaseB' part or not. If anyone else knows different, please speak up. -- -- Ron Guilmette, Sunnyvale, CA ---------- RG Consulting ------------------- ---- domain addr: rfg@netcom.com ----------- Purveyors of Compiler Test ---- ---- uucp addr: ...!uunet!netcom!rfg ------- Suites and Bullet-Proof Shoes -