Initializer list
Initializer list
Initializing variables can be done with Initializer list in the contructors
class Test {
int n;
char c;
public:
Test() : n(1), c{'o'} {}
Test(n) : n(n) {}
Test(Test& a) : n(a.n) {}
}
Initializing variables can be done with Initializer list in the contructors
class Test {
int n;
char c;
public:
Test() : n(1), c{'o'} {}
Test(n) : n(n) {}
Test(Test& a) : n(a.n) {}
}