Here is what I'm trying to do.

I have 3 classes:

base
|
derived1
|
derived2

In the main program, I call a function within the base class that sets 2 variables. In the derived class, I have a function that calls on a function within the base class to retrieve and return those variables.

The problem I'm having is that it is not working right, or I'm doing something wrong. What seems to be happening, is that when the function in the derived class calls the base class function, rather than just running, it first seems to run the default constructor, which zeros out the stored variables. Then the function returns the zeros.

Does that make sense? I'm new to C++ so I may be missing something, but from what I've read, in theory, this should work.

Why is it calling the default constructor first?

Any help would be greatly appreciated.

Thanks.