I have a questions about two different syntax of writing class constructor.
class Sample {
private:
int * p;
public:
// first way of writing the constructor
Sample()
{p = new int;
}
//second way of writing the constructor
Sample():p(new int)
{}
};
Is there any difference between the two different syntax? Or are they just the same thing? Thanks !