Article View: csu.cs.200
Article #124Re: Extend_STK()
From: Chris Carlson
Date: Thu, 22 Oct 1998 00:00
Date: Thu, 22 Oct 1998 00:00
27 lines
1764 bytes
1764 bytes
Try writing the Extend_STK function without the copy constructor and assignment operator. Basically, what I did was copy the stack to a temporary stack, extend the origonal stack by the extend size, and then copy the temporary stack to the extended stack. Also, make sure you update the maximum stack size. Hope this helps. Chris Carlson Adam Carheden wrote: > > I can't get my Stack.h ADT to compile. The problem is in the Extend_STK > function that uses both the copy constructor and assignment operator (=) > with &this as the argument. The compiler gives the error non-lvalue. > I used the copy constructor to make a new stack of greater size and the > assignment operator to set the old stack (this) to the new stack. > > Yes, I've tried compiling without this (as opposed to &this), but then I > get a type error. The copy constructor and assignment operator both > take Stack<...>& as arguments as shown in class. > > I think I'm totally on the wrong track with the whole Extend_STK > function. Any hints (not code of course, rules are rules) would be > appreciated. > TIA > -- > Adam > carheden@holly.colostate.edu
Technical Details
Message-ID:
<362F8A62.A3334FFB@holly.colostate.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<362EC559.7273D88A@holly.colostate.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 127144,6c45165c401d3feb X-Google-Attributes: gid127144,public From: Chris Carlson <spasm@holly.colostate.edu> Subject: Re: Extend_STK() Date: 1998/10/22 Message-ID: <362F8A62.A3334FFB@holly.colostate.edu> X-Deja-AN: 404033842 Content-Transfer-Encoding: 7bit References: <362EC559.7273D88A@holly.colostate.edu> To: Adam Carheden <carheden@holly.colostate.edu> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Colorado State University, Fort Collins, CO 80523 Mime-Version: 1.0 Newsgroups: csu.cs.200