kvt@drutx.ATT.COM (TranKV) (01/16/90)
I wonder if there's a good way to initialize a two dimensional array
(member of a class) through constructor. What I want to know if
I can declare a class such as:
class junk {
public:
junk (char **x) {
myar = x;
}
access () {
// play with myar
}
private:
char myar[2][10];
}
and then call:
class junk myobj ({"what", "when"});
The above desire is to match with C way of doing it:
char myar[2][10];
myar = { "what",
"when" };
only that hidding the array in a class makes it much cleaner and scope
more limited. Does anyone know why C++ cannot allow such a way of
initialization? Is there any other equivalences ?
Kim Tran
Bell Labs