Topic: C++ class ANATOMY-the physical structure


Author: walterz@bmerhaed.bnr.ca (Walter Zielinski)
Date: Sun, 13 Mar 1994 23:43:24 GMT
Raw View
Recently, I have started studing the idea of persistance and the possibility
of implementation in various languages. Could somebody give me some information
how the C++ class is stored in memory. The class being a logical concept composed of state and behaviour is physically stored in two parts data and
methods. How do they refrence methods from the data in C++.

For example if I have the following pseudo-code class definition

Class ThisClass
{
//data
 int a;
 float b;
 char c;
 char l[100];
//methods
 method1();
 method2();
 .
 .
 .
 methodn();
} ;


and I will declare/instantiate

main(){

Class ThisClass CallP1,CallP2,*CallP3;
CallP3=new ThisClass
}


How will the repository of data(Object) refrence the repository of code(Class).

OR SIMPL WHAT IS C++ OBJECT ANATOMY

If you don't have this info, you may know about sources where this information is stored (books/jurnals/ftp sites/people who know). I would realy appreciate
this information

Regards
Walter

--------------------------------------------------------------------------
f(!defined(STANDARD_DISCLAIMER))
#include<standard_disclaimer>
---------------------------------------------------------------------------
NOTE:
ALL THE OPINIONS AND COMMENTS EXPRESSED ARE MINE AND REPRESENT MY PERSONAL
BELIEVES NOT A COMPANY I WORK FOR AND REPRESENT.
-----------------------------------------------------------------------





Author: jlp@chi.andersen.com (Larry Podmolik)
Date: 13 Mar 1994 20:07:59 -0600
Raw View
In article <1994Mar13.234324.24527@bmers95.bnr.ca>, walterz@bmerhaed.bnr.ca (Walter Zielinski) writes:
> Recently, I have started studing the idea of persistance and the
> possibility of implementation in various languages. Could somebody
> give me some information how the C++ class is stored in memory. The
> class being a logical concept composed of state and behaviour is
> physically stored in two parts data and methods. How do they
> refrence methods from the data in C++.

This varies from compiler to compiler; there is no "standard" object
layout scheme.  Methods do not use any per-object storage, although in
most implementations each class with virtual functions has a static
pointer ("vptr") to a table of virtual function addresses ("vtbl").

A detailed discussion of one possible object layout scheme can
be found in the ARM, sections 10.1c through 10.10c (pages 217
through 236).

--Larry