Page 1 of 1

Class inheritance problem

PostPosted: Sep 29, 2002 @ 4:39pm
by Malmer
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?

PostPosted: Sep 29, 2002 @ 4:43pm
by Malmer
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)

PostPosted: Sep 29, 2002 @ 5:43pm
by sponge

PostPosted: Sep 30, 2002 @ 12:02am
by Jadam