I've been away from C++ for awhile and I am trying to determine the difference between these two default constructor initializations of a defined class's private member variables (if any). The class definition is in a header file while the implementation is in a separate file. All private member variables need to be initialized to "0" or a non-meaningful value.
NOTE:
int data[MAX_SIZE] is a fixed size compile time array. int used: is an index tracker for the array.
Generally speaking, I'm accustomed to initializing members in the following way:
// Default Constructor
IntSet::IntSet()
{
data[MAX_SIZE-1] = {0}
used = 0;
}
I'm combing through some legacy code and finding a completely different syntax:
// Default Constructor
IntSet::IntSet() : used(0)
{
data[MAX_SIZE-1] = {0};
}
Is there a difference in the end result?