I created a class and using multi-dimensional pointer as follows:
variable **v_mod;
v_mod = new variable *[3];
for(int i=0;i<3;i++)
{
v_mod[i] = new variable [n];
}
and deleting pointer after using
for( int i = 0 ; i < 3 ; i++ )
{
delete [] v_mod[i];
}
delete [] v_mod;
This is working perfectly fine but I am using many pointers. So can anyone help in writing a function in the class which helps in creating and deleting the pointers like
variable ** v_mod;
v_mod.create(3,n);
v_mod.delete();
and which works same way?