From -6539091044745342899
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,3b19a004e78de1c9
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1994-02-28 22:04:22 PST
Path: gmd.de!xlink.net!howland.reston.ans.net!vixen.cso.uiuc.edu!uwm.edu!fnnews.fnal.gov!not-for-mail
From: b91926@fsgi01.fnal.gov (David Sachs)
Newsgroups: comp.std.c++
Subject: Re: Standard for order of base-class specification?
Date: 1 Mar 1994 00:04:22 -0600
Organization: FERMILAB, Batavia, IL
Lines: 26
Message-ID: <2kult6$87n@fsgi01.fnal.gov>
References: <HOLCOMB.94Feb28155855@donald.wg.com>
NNTP-Posting-Host: fsgi01.fnal.gov

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

B
>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 know if the language defines this, or if it's
>compiler specific.

The language DOES NOT define this; it is compiler specific.
It is quite likely that the offset of BaseB will NOT be
sizeof (BaseA), especially if there a virtual functions.


