PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Class inheritance problem

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?
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)
Malmer wrote:
Forget it...I didn't notice I was declare a new CSub* subs in the inherited class. How could I miss that?


Malmer and his wacky hijinks ;)
sponge":2q02ysrk]

Sponge and his wacky hijinks ;)