Hello all, I have a very simple question regarding reading some code:
If the code is:
--
class ClassName {
public:
ClassName (int x = 0) : _variable1(at),
_variable2(2) {}
private:
int _variable1;
int _variable2;
};
--
Is the the same as creating a constructor with the statements
...
public:
ClassName (int x = 0)
{
_variable1 = x;
_variable2 = 2;
}
...
?
Thanks!
If the code is:
--
class ClassName {
public:
ClassName (int x = 0) : _variable1(at),
_variable2(2) {}
private:
int _variable1;
int _variable2;
};
--
Is the the same as creating a constructor with the statements
...
public:
ClassName (int x = 0)
{
_variable1 = x;
_variable2 = 2;
}
...
?
Thanks!