Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pacbell!att!drutx!kvt From: kvt@drutx.ATT.COM (TranKV) Newsgroups: comp.lang.c++ Subject: array init within objects Summary: array init with constructor Keywords: array, constructor Message-ID: <4854@drutx.ATT.COM> Date: 15 Jan 90 18:16:34 GMT Reply-To: kvt@drutx.ATT.COM (TranKV) Organization: AT&T, Denver, CO Lines: 33 References: 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