While I was working in c++ I see two type of ctor definition.. Is there any difference while assigning value? Does one of them has advantages or just writing style ?
1st ctor definition:
class X
{
public:
X(int val):val_(val){}
private:
int val_;
};
2nd ctor definition:
class X
{
public:
X(int val)
{
val_ = val;
}
private:
int val_;
};