0
why is {} placed after member initializer list in c++, although it is supposed to be empty ?
class myclass{ public: myclass(int a, int b, int c) :var1(a),var2(b),var3(c) { // these curly braces. } //these curly braces. private: int var1,var2,var3; };
1 Answer
+ 6
It's because when you define a function, it needs a body, the curly brackets is used to define the function body, even though it's empty