Top "Initialization-list" questions

Initialisation lists are used to initialise class members in other than default manner.

C++ Constructors vs Initialization Lists speed comparison

Are there any differences in execution time between constructors and initialization lists?(or is it just a matter of coding …

c++ constructor initialization-list
Benefits of Initialization lists

Of what I know of benefits of using initialization list is that they provide efficiency when initializing class members which …

c++ initialization-list
Zero-Initialize array member in initialization list

I have a class with an array member that I would like to initialize to all zeros. class X { private: …

c++ initialization initialization-list array-initialization
can member functions be used to initialize member variables in an initialization list?

OK, member variables can be used to initialize other member variables in an initialization list (with care taken about the …

c++ initialization-list
Default constructor in template class with attribute of unknown type

I need a default constructor with no argument. How can I initialize attribute a which is of unknown type to …

c++ templates initialization-list
Initialize array of char in initialization list of constructor in C++

Is it ok to use initialization like this? class Foo { public: Foo() : str("str") {} char str[4]; }; And this? int main() { …

c++ arrays class initialization-list
C++: Initialization of inherited field

I've a question about initialization of inherited members in constructor of derived class. Example code: class A { public: int m_…

c++ initialization initialization-list
Class member without a default constructor

Suppose I have a class A without a default constructor, a factory method factoryA that returns an object of type …

c++ default-constructor initialization-list
C++ Class Initialization List example

I am going through Chapter 17 in the new Stroustrup book and I am confused by initializing a class with an …

c++ class object initialization-list
Order of calling base class constructor from derived class initialization list

struct B { int b1, b2; B(int, int); }; struct D : B { int d1, d2; // which is technically better ? D (int …

c++ inheritance constructor base-class initialization-list