Can someone please show me how I would create these constructors in the source file...my compiler tells me I have errors. I know I set up my main, header, and source file correctly because I am getting no errors until I start implementing the constructors.
In the HEADER file:(xArray.h)
class xArray{
public:
//constructors
xArray();
xArray(const xArray& a);
xArray(const int x);
private:
size_t len;
size_t size;
//data of int array
int *data;
};
In the source file: (xArray.cpp)
//this is the constructor I am unsure about
xArray::xArray(const xArray& a){
// ? ? ? ? ? ? ? ? ?
}
//these two constructors I believe are correct...my compiler does not return any
//errors
//constructor 1
xArray::xArray(){
len = 0;
size = 0;
data = new int[size];
}
//constructor 3
xArray::xArray(const int x){
len = 0;
size = x;
data = new int[x];
}
All help is greatly appreciated.