Question about Inheritance/Constructors

Hello all. So I have two classes:

Parent Class: Load
Child Class: Blit

When I separate the two objects like I have below, cLoad.LoadPicture()
always comes back false and I error checked the function so I know it is
error free.

1
2
3
4
5
6
7
Load cLoad;
if(cLoad.LoadPictures() == false)
    return 21;

Blit cBlit;
if(cBlit.LoadPictures() == false)
    return 31;


BUT, when I initialize the child and parent class before I call
any function from either I get no error. It would look like this:

1
2
3
4
5
6
7
8
Load cLoad;
Blit cBlit;

if(cLoad.LoadPictures() == false || cLoad.LoadSounds() == false)
    return 21;

if(cBlit.LoadPictures() == false)
    return 31;


It is like I can't initialize the parent class object without the
child class object being initialized. Can someone please shed some
light on this. Thanks.


EDIT:

I just realized I do not have to call the cLoad.LoadSounds() function from
the base class because the child class can do the exact same thing but
still...why am getting the original problem?
Last edited on
> why am getting the original problem?
_ accessing out of bounds
_ messing with class members
_ you don't
_ your princess is in another castle
_ cosmic rays

Just an educated guess
If LoadPicture always comes back false then the problem is within that function, regardless of whether it is considered error free.

Without seeing the function itself or the class definitions there's little help that can be offered here.
Last edited on
Topic archived. No new replies allowed.