http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lets try that again: Need help with pure virtual base class



============================================================
A personal trainer for your email inbox, My Topica's  free
newsletter management system provides total email
conditioning thru archives, organizers, and options.
http://click.topica.com/caaabDlbUrGczbU68iFa/register
============================================================

On Fri, 13 Apr 2001, William Gifford wrote:

> CRect myRect;
> CObject *object;
> object = &myRect;
> 
> Everything is good up to this part. I then call on my engine to append 
> the object to a list like so:

	Actually this is where the problem is.  "CRect myRect" creates an
automatic variable that is on the stack.  When that function returns this
object gets destroyed (you can show this to yourself by putting something
(printf, OutputDebugString, breakpoint) in the destructor and running the
program).
	What you want to do is:
CRect * const myRect=new CRect( <constructor arguments> );
<push the object onto your renderer>

--
Marc Hernandez

==^================================================================
EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrGcz.bU68iF
Or send an email To: gameprogrammer-unsubscribe@topica.com
This email was sent to: list@pendleton.com

T O P I C A  -- Learn More. Surf Less.
Newsletters, Tips and Discussions on Topics You Choose.
http://www.topica.com/partner/tag01
==^================================================================