The code below works. I have a simple class with one integer and an array of integers. I have a NULL constructor that initializes the integer to 0, and initializes the array to have 0 elements. I have a second constructor that initializes the integer to the parameter passed to it and initializes the array to have 0 elements. This trivial example has 2 lines of duplicated constructor code for the array, but it's easy to imagine much more duplication. I am wondering if it's possible to only have the array initialization code in the NULL constructor and have one constructor call the other constructor so everything gets initialized without duplicating code.

Code:
#include <iostream>
using namespace std;




class a
{
private:
    int x;
    int array_size;
    int* array;
public:
    a();
    a(int param_x);
    ~a();


friend ostream& operator << (ostream& outs, const a& obj);
};




a::a()
{
    cout << "NULL Constructor\n";
    x = 0;
    array_size = 0;
    array = NULL;
}




a::a(int param_x)
{
    cout << "int Constructor\n";


    // Can I replace the two lines below with a call to the NULL constructor?
    array_size = 0;
    array = NULL;


    x = param_x;
}




a::~a()
{
    cout << "Destructor\n";


    if(array != NULL)
    {
        delete []array;
    }
}




ostream& operator << (ostream& outs, const a& obj)
{
    outs << "x=" << obj.x << ":array_size=" << obj.array_size << endl;
    if(obj.array == NULL)
    {
        return outs;
    }
    for(int i = 0; i < obj.array_size; i++)
    {
        outs << "array[" << i << "]=" << obj.array[i] << "\n";
    }
    return outs;
}




int main()
{
    a object(8);
    cout << object;
    return 0;
}