🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: csu.cs.200
Article #123

Re: Extend_STK()

#123
From: x1e1r1
Date: Thu, 22 Oct 1998 00:00
36 lines
1898 bytes
Adam Carheden wrote in message <362EC559.7273D88A@holly.colostate.edu>...
>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.
>

Have Extend_STK create a larger stack in the body of the function, without
making any
other calls.  Then just assign the variables their proper values( e.g.
Stackptr).  I didn't
have Extend_STK use the copy constructor or the assignment operator in its
body,  and
it worked fine.  I believe the copy constructor should just be used mainly
to instantiate
a second stack from main (Stack<..,..,..>  S1; Stack<..,..,..>  S2(S1); as
an example).
Feel free to email back if you have other questions
                                                        Josh Thomas

x1e1r1@concentric.net


>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: <70nio3$kbt@chronicle.concentric.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <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: <x1e1r1@concentric.net>
Subject: Re: Extend_STK()
Date: 1998/10/22
Message-ID: <70nio3$kbt@chronicle.concentric.net>
X-Deja-AN: 403947349
References: <362EC559.7273D88A@holly.colostate.edu>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Organization: Concentric Internet Services
Newsgroups: csu.cs.200