This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Class inheritance problem


Class inheritance problem

Postby Malmer » Sep 29, 2002 @ 4:39pm

I have a inherited class, and in the baseclass there is a function to load data from a file. In this function I set some variables, like normal integers. With them I have no problems. The inherited class gets those values with no problems. But I also have a pointer defined like this:

CSub* subs;

Now, in the function I do like this:

subs = new CSub[10];

It works perfectly when just running in the base class, but it doesn't work in the inherited class. As soon as it finishes the function it doesn't remember it. It works to access it from inside the function, but I later can't. Then it is as if it was never set. But normal integers work. Someone please enlighten me. What am I doing wrong?
All your base are belong to us
User avatar
Malmer
pm Member
 
Posts: 768
Joined: Apr 26, 2001 @ 5:15pm
Location: Sweden


Postby Malmer » Sep 29, 2002 @ 4:43pm

Forget it...I didn't notice I was declaring a new 'CSub* subs' in the inherited class. How could I miss that?

(Modify: fixed a grammar thing)
Last edited by Malmer on Sep 29, 2002 @ 6:58pm, edited 2 times in total.
All your base are belong to us
User avatar
Malmer
pm Member
 
Posts: 768
Joined: Apr 26, 2001 @ 5:15pm
Location: Sweden


Postby sponge » Sep 29, 2002 @ 5:43pm

holy internets batman.
User avatar
sponge
Not sponge
 
Posts: 12779
Joined: Jan 13, 2002 @ 8:04am
Location: New Hampshire


Postby Jadam » Sep 30, 2002 @ 12:02am

User avatar
Jadam
I'm a STAR!
 
Posts: 3245
Joined: Apr 9, 2002 @ 7:24pm
Location: Stony Brook, NY


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum