I am attempting to ask this question again due to my failure to state the question clearly yesterday. Basically, I have an access violation error described in the comment in the code below… any idea why?
Class A
{
private:
BOOL a;
BOOL b;
int i;
public:
A() {a = FALSE; b = FALSE; i = 0;}
....
}
Class B : public A
{
public:
B() {} // empty constructor
....
}
Class C
{
public:
C() {} // <-- when the constructor is calling the CButton and CCombobox
// default constructor for the member "cb" and "button", it overrides
// the address space of some of the variables defined in class A
// (e.g. a, and b would be changed to some garbage)
// Basically, any variable defined below 'y' will have similar
// problems, though not exactly the same variables from 'y' will
// be changed..
private:
int x;
B y;
CCombobox cb;
CButton button;
}
I’ve found the solution to my problem. The cause of the problem is that Class A is built to a dll with a different struct alignment than class B and C.