Initializer List is used in initializing the data members of a class. The list of members to be initialized is indicated with constructor as a comma-separated list followed by a colon.
We must use initializer list in a constructor when
* There is a reference variable in class
* There is a constant variable in class
* There is an object of another class. And the other class doesn’t have default constructor.
```
#include<iostream>
using namespace std;
class Test {
const int t;
public:
Test(int t):t(t) {} //Initializer list must be used
};
int main() {
Test t1(10);
return 0;
}
```