Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!ames!killer!usl!pcb From: pcb@usl.usl.edu (Peter C. Bahrs) Newsgroups: comp.lang.c++ Subject: Initializer in C++ Keywords: constructor, operator= Message-ID: <668@usl.usl.edu> Date: 6 Feb 89 01:39:10 GMT Organization: CACS, Lafayette, LA, USA Lines: 29 In standard C we have the ability to initialize arrays such as: int x[] = {1,2,3}; and static int x[2][3] = {{1,2,3},{4,5,6}}; etc... I would like to have a class such as ARRAY (actually matrix) that takes initializers... ARRAY x(2,3)={{1,2,3},{4,5,6}}; So the construct would?? be someting like: ARRAY (int r, int c) { allocate the buf to be r by c... } And now I guess the operator= would be: void operator=(int *s) { now loop through and let each buf[i][j] = *s and then s++ } This is as close as I have come, however it doesn't work, the operator= never gets called. Maybe the constructor should take another parameter??? Does anyone have an idea? Thanks in advance. pcb@usl.usl.edu