| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| 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...
NH> The destructor will be called only when it goes out of scope. What I
NH> want to do is create a ClassB object with a pointer to an already-
NH> existing ClassA object.
yeah, the scope above is contained between { and }
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> }
NH> Actually, constructing an object without passing a parameter will be an
NH> error. I guess I should have included an "assert()" but
I really think
NH> that there's got to be a gentler way out of the situation.
If you don't want to do it then leave that constructor out.
JB>> what's this all for? a subtring class or something like it?
NH> I've got a CDatabase class, used for reading, editing and deleting data
NH> a row at a time. I wish to also have a CLink_List class which will
NH> create linked lists of data from selected columns of ALL rows (used
NH> solely for display). I'm not doing this because I'm sure it's the best
NH> way but rather as an experiment ... because I CAN do it this way.
:)
NH> Can you think of another, possibly better way to do this?
depends how good your database stuff is...
it might just need a little wrapper to behave like a linked list.
-=> Bye <=-
---
* Origin: I smell a rat. Did you bake it or fry it? (3:640/1042)SEEN-BY: 633/267 270 @PATH: 640/1042 531 954 774/605 123/500 106/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™.