I have a class that I am converting:
class MyClass
{
public::
void foo( void )
{
static const char* bar[][3] = { NULL };
func( bar );
}
};
Now I want to make bar a member variable, but since the first dimension is not supported, I cannot. I also can not pass const char** bar[3]in void func( const char* param[][3] ). Is there a workaround for this that I don't know about, or is it a situation where I have to use a method static?
Edit in response to Jarod42
Initialization matching baris my problem here. I think that at least I could do this in the ctor package, if not for the ctor initialization list. Here are some test codes:
static const char* global[][3] = { NULL };
void isLocal( const char* test[][3] )
{
if( test == NULL )
{
cout << "uncool" << endl;
}
else if( *test[0] == NULL )
{
cout << "cool" << endl;
}
}
class parent
{
public:
virtual void foo( void ) = 0;
};
parent* babyMaker( void )
{
class child : public parent
{
public:
virtual void foo( void )
{
static const char* local[][3] = { NULL };
isLocal( local );
isLocal( global );
isLocal( national );
}
child():national( nullptr ){}
private:
const char* (*national)[3];
};
return new child;
}
int main( void )
{
parent* first = babyMaker();
first->foo();
}