mike.h on Sun, 14 Jul 2002 20:50:07 +0200 |
Fred, You do not appear to be declaring the local pointer varible in your snip: voxInstallCommon::voxInstallCommon(QLabel *qlIncoming) { QLabel *qlBillBoard=new QLabel("unlabeled", 0, 0); qlBillBoard=qlIncoming; ... -mike -----Original Message----- From: plug-admin@lists.phillylinux.org [mailto:plug-admin@lists.phillylinux.org]On Behalf Of Fred K Ollinger Sent: Saturday, July 13, 2002 11:27 AM To: plug@lists.phillylinux.org Subject: [PLUG] [ON TOPIC] passing a pointer to an object to an object (c++) I have this code where I have an object and I'd like to modify it while in another object. Is there a way to do this? I get segfaults when I do: // begin snippet voxInstallCommon::voxInstallCommon(QLabel *qlIncoming) { qlBillBoard=new QLabel("unlabeled", 0, 0); qlBillBoard=qlIncoming; //end snippet Why? Is there a better way to gain access to an oject in another object? I have spent a lot of time reading about this and trying permutations to no avail. I want the oject to be persistent in the other object. I have successfully passed a pointer to an object in the function, but the pointer is not persistent so I'm trying to do this via a constructor and then make a pointer to the pointer. Since all the pointers are aiming at the same patch of memory this should work, but it doesn't. Fred Ollinger (follinge@sas.upenn.edu) CCN sysadmin ______________________________________________________________________ Philadelphia Linux Users Group - http://www.phillylinux.org Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce General Discussion - http://lists.phillylinux.org/mail/listinfo/plug ______________________________________________________________________ Philadelphia Linux Users Group - http://www.phillylinux.org Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce General Discussion - http://lists.phillylinux.org/mail/listinfo/plug
|
|