Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hp-pcd!hplsla!jima From: jima@hplsla.HP.COM (Jim Adcock) Newsgroups: comp.lang.c++ Subject: Re: Class initialization Message-ID: <6590255@hplsla.HP.COM> Date: 18 Sep 89 18:49:14 GMT References: Organization: HP Lake Stevens, WA Lines: 48 //re your second question: #include typedef char* cstring; class cstringStack; static const int cstringStack__maxCstringSpace = 10000; class cstringStack { static cstring cstringSpace[cstringStack__maxCstringSpace]; static int cstringSpaceUsed; cstring* element; int top; public: cstringStack(const int stacksize): top(0), element(&cstringSpace[cstringSpaceUsed]) {cstringSpaceUsed += stacksize; } void push(const cstring s){element[top++] = s;} cstring pop(){return element[--top];} cstringStack& popprint(){printf("%s\n",this->pop()); return *this;} }; cstring cstringStack::cstringSpace[10000] = {0}; int cstringStack::cstringSpaceUsed = 0; void main() { cstringStack stk1(30); stk1.push("hi mom"); stk1.push("hello dad"); stk1.push("bye world"); stk1.popprint().popprint().popprint(); cstringStack stk2(40); stk2.push("hi mom too"); stk2.push("hello dad too"); stk2.push("bye world too"); stk2.popprint().popprint().popprint(); }