From: jesjones AT halcyon DOT com (Jesse Jones) Newsgroups: comp.lang.c++,comp.os.msdos.djgpp,rec.games.programmer Subject: Re: Template Class as Object Function Parameter Date: Thu, 22 Jan 1998 22:00:00 -0700 Organization: Edmark Lines: 23 Message-ID: References: <34C8192D DOT 6DE290C4 AT nwrain DOT com> NNTP-Posting-Host: 12264 AT 204 DOT 201 DOT 213 DOT 51 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In article <34C8192D DOT 6DE290C4 AT nwrain DOT com>, obremski AT nwrain DOT com wrote: > I was just wondering why the following code doesn't work. I have a > template class called Array. And in one function I wish to have a > parameter that is of this class and the SAME type as the current class > object. So I naturally thought that 'Array
*src' would work, but i > get errors. Please help =) > > template > int Array
::copy (Array
*src, long int loc) > { > > // --- function meat goes here =) --- \\ > > return 0; > } Looks like it should work to me. What kind of errors are you getting? BTW when copying objects within template code it's a good idea to use STL's copy function. Quality implementations will provide specializations of copy() for simple types like ints and floats that can be copied via memcpy. --Jesse