Today would have it, write an example of a proxy class, read, read out of the question, see the following code
const int _cap = 10; Array1D* _elemArray = new Array1D[_cap];
At the same time I wrote a constructor for Array1D this class to replace the compiler generated automatically
Array1D(int inx) { _elemNum = new T[inx]; }
Subsequently error, suggesting no appropriate default constructor, but obviously, I am here is to provide a constructor, then the problem lies in the existing constructor can not cope with the above new statement
Contact configuration of the vector: vector <int> * vec = new vector <int> [20] (25); 20 is a vector length of the array, the array 25 is the length of each vector, we can know, there should be there are three types of information passed:
1. new allocated memory, the memory of the application object type is a vector
2. A total of 20 such objects
3.25 as the first argument to the constructor incoming objects
Then [_cap] view, _cap The new Array1D not passed as an argument to the constructor Array1D this class, but as a new parameter memory allocation function used
That is, the above code can see this new (Array1D, _cap, ③);
③ parameters which should be passed to the constructor
It is clear, I have provided above constructor must have a parameter exists (because there is no default value is used, if in fact this issue to a default value inx do not need to provide a new no-argument constructor, but separating out the problem understanding of C ++ constructors more helpful, I think the default value a bit around this problem means (escape)), but the top of the code does not provide this parameter, so here is actually no need to construct a parameter function added to the code (this code actually did not need, empty function body no problem), after they passed the compiler.