473,396 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

MS VC++ 6.0 object memory layout

Referring to the following links.
1.
http://groups-beta.google.com/group/...6539a90194bfbc
2.
http://msdn.microsoft.com/archive/de...angrayhood.asp

Q1. Can somebody tell what does the phrase
"non-virtually-inherited parts" as referred in John Gray's post at the
end of the page referred by 1st link

Also, for class M: public X, public Y
where X and Y both have virtual functions (and thus have vfptrs),
class M will contain two vfptrs (one each for embedded instances of X
and Y).

Q2. Each class has only one vftable asociated with it. So, do the two
vfptrs (as above) point to the same vtable? The rule of one vtable is
violated when doing virtual inheritance of a base class with virtual
functions and derived class adding new virtual functions.

Q3. Also, the vtable for M will have two entries for the same func().
When doing a lookup for func(), which of the two entries is refrred to.

Jul 23 '05 #1
1 2253
an*********@gmail.com schreef:
Also, for class M: public X, public Y
where X and Y both have virtual functions (and thus have vfptrs),
class M will contain two vfptrs (one each for embedded instances of X
and Y).
Probably three, as M might add virtual functions of its own.
Q2. Each class has only one vftable asociated with it. So, do the two
vfptrs (as above) point to the same vtable? The rule of one vtable is
violated when doing virtual inheritance of a base class with virtual
functions and derived class adding new virtual functions.
What rule? It probably wouldn't work, either. X and Y are unrelated,
and have different virtual functions. I.e. the first virtual function
will differ, and __vtable[0] will then be different.
Q3. Also, the vtable for M will have two entries for the same func().
When doing a lookup for func(), which of the two entries is refrred to.


Name lookup doesn't happen at runtime in vtables, but at compile time.

HTH,
Mchiel Salters

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: shamel | last post by:
Hi, I'm just starting to use OO4O on a project and I do not know a lot about Oracle. I wrote a standard Windows DLL using VC++ 6. In this DLL, I have a database class (DbOO4OClass) that use...
18
by: Tarundeep | last post by:
hi, let us say it is a 32 bit processor then the size of the pointer is 32 bits. now i want to know what would be the size of the class with vtable pointer in it , that is it has few virtual...
7
by: Mariano López | last post by:
Hi, I found a program on the net and I'm having some problems with it. Basically what this program does is communicate with Winamp, but it can use the functions that are supposed to work only for...
100
by: E. Robert Tisdale | last post by:
What is an object? Where did this term come from? Does it have any relation to the objects in "object oriented programming"?
6
by: bramdoornbos | last post by:
Hello, I am looking for a solution to interface with C++ classes implemented in a dll compiled by gcc. This dll will be however accessed by a visual c++ compiled host (not made by me). Both...
17
by: Fabry | last post by:
Hi All, I'm new of this group and I do not know if this is the correct group for my question. I have a DLL with its export library (.lib) wrote in Borland C++ 6. In borland everything is OK and...
13
by: Creativ | last post by:
I've looked through this thread and still have quetions. Suppose In visual studio 2005, I write the following #pragam managed class ManagedWrapper { void CallUnmanagedMethod() // The unmanaged...
6
by: Mohamed Fysal | last post by:
Hi, I have a major problem. I am using a VB exe which is having a structure declared and it looks like below Public Type SCANNEDIBUTTNO IButtonUserNumber As String * 32
23
by: tonytech08 | last post by:
What I like about the C++ object model: that the data portion of the class IS the object (dereferencing an object gets you the data of a POD object). What I don't like about the C++ object...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.