![]() |
|
#1
|
|||
|
|||
Initializer ListHi C++ Coders,
I have a query. I was going through practising some C++ programs. We know that base class constructor is invoked first before derived class constructor. Now suppose I have a program: CPP / C++ / C Code:
I have created an initializer list to initialize i as 10. But the foo class constructor should be invoked first before bar constructor. When I am running the program, then foo constructor is displaying as 10. My qs is how 10 value is getting when derived class constructor has not been invoked yet? Last edited by admin : 11-Jul-2008 at 22:54.
Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
|
|||
|
#2
|
|||
|
|||
Re: Initializer ListCPP / C++ / C Code:
Quote:
Quote:
|
|
#3
|
|||
|
|||
Re: Initializer ListQuote:
Consider the following changes to your posted code: CPP / C++ / C Code:
Code:
|
|
#4
|
|||
|
|||
Re: Initializer ListInitializer List called before enter into {}.
I hope this help. |
Recent GIDBlog
Accepted for Ph.D. program by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Str_Misaligned in Double Link List | Peter_APIIT | C Programming Language | 1 | 29-Feb-2008 21:50 |
| Airport Log program using 3D linked List : problem reading from file | batrsau | C Programming Language | 11 | 29-Feb-2008 08:44 |
| need 'pointers' on deaing with segmentation faults | aijazbaig1 | C Programming Language | 7 | 17-Aug-2007 08:43 |
| C++ class -- Please help | vnca_1 | C++ Forum | 3 | 14-Jun-2006 13:31 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The