TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: Jasen Betts
from: Neil Heller
date: 2003-01-17 17:43:00
subject: Declaring a pointer to a

NH> void  ClassA::DoitA()
NH> {
NH>    ClassB cb(this);
NH> }

JB> That creates and destroys "cb"  but I thought you didn't want to do
JB> that...

The destructor will be called only when it goes out of scope.  What I 
want to do is create a ClassB object with a pointer to an already-
existing ClassA object.

JB> // this isn't used in your example but looks incomplete...
JB>  NH> ClassB::ClassB()
JB>  NH> {
JB> // maybe you should have this:
JB>       abc=NULL
JB>  NH> }

Actually, constructing an object without passing a parameter will be an 
error.  I guess I should have included an "assert()" but I really think 
that there's got to be a gentler way out of the situation.

JB> what's this all for?  a subtring class or something like it?

I've got a CDatabase class, used for reading, editing and deleting data 
a row at a time.  I wish to also have a CLink_List class which will 
create linked lists of data from selected columns of ALL rows (used 
solely for display).  I'm not doing this because I'm sure it's the best 
way but rather as an experiment ... because I CAN do it this way.

Can you think of another, possibly better way to do this?

þ CMPQwk 1.42 999

--- Maximus/2 3.01
* Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000)
SEEN-BY: 633/267 270
@PATH: 106/2000 1 379/1 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.