473,326 Members | 2,114 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,326 software developers and data experts.

virual inheritance and base class initialisation

Can someone explain the initialization of the base class when virtual
inheritance is used?
thanks
cric

Oct 14 '05 #1
2 1212

<fr*******@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Can someone explain the initialization of the base class when virtual
inheritance is used?


Please see:
http://www.parashift.com/c++-faq-lit....html#faq-25.8
http://www.parashift.com/c++-faq-lit....html#faq-25.9

Regards,
Sumit.
--
Sumit Rajan <su*********@gmail.com>
Oct 14 '05 #2
fr*******@yahoo.com wrote:
Can someone explain the initialization of the base class when virtual
inheritance is used?
thanks
cric

Initialization occurs as follows:

1. For the most derived class, the virtual base classes are initialzied
in a depth first, L to R sequence.

then the following happens in a recursive fashion:

2. Direct bases are initialized in the order they are listed in the
class declaration.

3. Members are initialized in the order they are declared.

4. The constructor body is run
Oct 15 '05 #3

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

Similar topics

8
by: Dan Perl | last post by:
Here is a problem I am having trouble with and I hope someone in this group will suggest a solution. First, some code that works. 3 classes that are derived from each other (A->B->C), each one...
3
by: mescaline | last post by:
//Consider the simple program with inheritance, plain init for A, copy ctr for B #include <iostream> using namespace std; class Base{ public: Base(){cout << "Base, default" << endl;}...
3
by: Tom | last post by:
Hello, I've searched groups and the std unsuccessfully for an explanation of the following - I'd appreciate any comments you may have. Given the following diamond multiple inheritance pattern,...
10
by: Ioannis Vranos | last post by:
May someone explain why does this compile? class HiddenSealBaseClass { public: HiddenSealBaseClass() { } }; class Sealed: virtual HiddenSealBaseClass
3
by: James | last post by:
I have a base class that has constructor Person(string name, int age) and a derived class Empolyee(string job_title, int salary) When I try to call it using new Employee(name, age, job_title,...
30
by: Elhanan | last post by:
hi all i have a question in desgning a form.. the application in question is something a indexing station. the user in this indexing station views a document in pdf/tiff format on the right...
14
by: Bruno van Dooren | last post by:
Hi all, i am having a problems with inheritance. consider the following: class A { public: A(int i){;} };
3
by: Jess | last post by:
Hello, I've been reading Effective C++ about multiple inheritance, but I still have a few questions. Can someone give me some help please? First, it is said that if virtual inheritance is...
11
by: George Sakkis | last post by:
I have a situation where one class can be customized with several orthogonal options. Currently this is implemented with (multiple) inheritance but this leads to combinatorial explosion of...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.