Calling constructor inside another constructor (No matching function to call...)

I've written an Array class to create 1d,2d and 3d array and it works fine for every test : example of the constructor of the array class for 2d case:
Array::Array( int xSize, int ySize )
xSize_ = xSize;
ySize_ = ySize;
zSize_ = 1;

It works fine , but when i need to use this constructor inside of other constructor, i get the "no matching function error" ,
part of my code:
class StaggeredGrid
StaggeredGrid ( int xSize1, int ySize1, real dx, real dy ) : p_ (2,2) {}
Array p_;

complete error:
No matching function for call to Array::Array()
Candidates are : Array::Array(int)
Array::Array(int, int)
Array::Array(int, int, int)
I would appreciate if anybody knows the problem
closed account (D80DSL3A)
Try StaggeredGrid ( int xSize1, int ySize1, real dx, real dy ) : p_(Array(2,2)) {}
It did not work.
But the problem was solved by adding a default constructor Array::Array() into my array class.
Last edited on
Topic archived. No new replies allowed.