Hello,
Regarding the variable layout with multi inheritance, I looked into a
couple of C++ books but I was not able to find a descent answer.
Let assume I have the following:
class A{
int x;
}
int A::getX(){ return x;}
class B{
int y;
}
int B::getY(){ return y;}
class C: virtual A, virtual B {
}
In A the offset of x is 0. Same thing for B, the offset of y is 0.
But what is the variable layout of C?
If x'offset = 0 and y's offset = 1, what's happen with the getY()
method ? Is it duplicated to take the new offset into account ? Or is
there any dynamic lookup of variables ?
Cheers,
Alexandre 2 1524
bergel wrote: Hello,
Regarding the variable layout with multi inheritance, I looked into a couple of C++ books but I was not able to find a descent answer. Let assume I have the following: class A{ int x; } int A::getX(){ return x;}
No such function has been declared. class B{ int y; } int B::getY(){ return y;}
Similarly. class C: virtual A, virtual B { }
In A the offset of x is 0. Same thing for B, the offset of y is 0. But what is the variable layout of C? If x'offset = 0 and y's offset = 1, what's happen with the getY() method ? Is it duplicated to take the new offset into account ? Or is there any dynamic lookup of variables ?
Cheers, Alexandre
Important question: Why do you care?
This is a question about `under the hood' implementation, not one about
the C++ language itself.
--ag
--
Artie Gold -- Austin, Texas http://it-matters.blogspot.com (new post 12/5) http://www.cafepress.com/goldsays
Because I am interested in muti-inheritance mechanism.
Alexandre
--
_,.;:~^~:;._,.; :~^~:;._,.;:~^~ :;._,.;:~^~:;._ ,.;:
Alexandre Bergel http://www.iam.unibe.ch/~bergel
^~:;._,.;:~^~:; ._,.;:~^~:;._,. ;:~^~:;._,.;:~^ ~:;. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brian Jones |
last post by:
I'm sure the solution may be obvious, but this problem is driving me
mad. The following is my code:
class a(object):
mastervar =
def __init__(self):
print 'called a'
|
by: Jon Skeet [C# MVP] |
last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the
article on all the groups this is posted to.
I've finally managed to finish my article on multi-threading - at least
for the moment. I'd be *very* grateful if people with any interest in
multi-threading would read it (even just bits of it - it's somewhat
long to go through the whole thing!) to check for accuracy,
effectiveness of examples, etc.
Feel free to mail...
|
by: Petar#M |
last post by:
Dear all,
Is there any way to derive the offset of a subclass without instantiating
the class (in other words none of the *_cast operators can be used).
So, e.g.:
class A {};
class B {};
class C : public A, public B {};
|
by: Enoch Chan |
last post by:
I would like to set a Session variable to a value. In Vbscript it should be
Session("ZoomValue")=500
How can I set this session variable by using Javascript?
Thanks
|
by: Graham |
last post by:
This has to do with class variables and instances variables.
Given the following:
<code>
class _class:
var = 0
#rest of the class
| |
by: Bernard Bourée |
last post by:
Is there a way to overpass the impossibility of VN.NET to accept the multi
heritage, that is to allow a class to inherit from TWO mother classes ?
--
Bernard Bourée
bernard@bouree.net
|
by: chandra.krothapalli |
last post by:
Hi,
I am writing a program to read database logs using db2Readlog/
db2ReadLogNoConn API.
I am able to parse the data of "FIXED format data" and link them to
appropriate columns for a given UPDATE/INSERT/DELETE.
I am having difficulty in parsing the "Variable format data". In the
log record I am not able find information about data length of each
|
by: dpapathanasiou |
last post by:
I have some old Common Lisp functions I'd like to rewrite in Python
(I'm still new to Python), and one thing I miss is not having to
declare local variables.
For example, I have this Lisp function:
(defun random-char ()
"Generate a random char from one of "
(if (< 50 (random 100))
(code-char (+ (random 10) 48)) ; ascii 48 = 0
|
by: GTalbot |
last post by:
Hello fellow comp.infosystems.www.authoring.stylesheets colleagues,
Imagine this situation:
#grand-parent-abs-pos
{
height: 400px;
position: absolute;
width: 600px;
}
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |