![]() |
|
#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 21: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
Install Adobe Flash - Without Administrator Rights by LocalTech
| 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 20:50 |
| Airport Log program using 3D linked List : problem reading from file | batrsau | C Programming Language | 11 | 29-Feb-2008 07:44 |
| need 'pointers' on deaing with segmentation faults | aijazbaig1 | C Programming Language | 7 | 17-Aug-2007 07:43 |
| C++ class -- Please help | vnca_1 | C++ Forum | 3 | 14-Jun-2006 12:31 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The