Topic: Microsoft Foundation classes and virtually derived classes


Author: tanner@cg-atla.UUCP (Tim Tanner)
Date: 20 Jan 95 16:25:18 GMT
Raw View
In using the Microsoft Visual C++ programming environment with the
Microsoft Foundation Classes for the first time, creating a Windows
executable, I have found difficulty in trying to due the following:


class A {
 public:
 A(){};
 ~A(){};
};

class B : public virtual A
{
 public:
 B(){};
 ~B(){};
};

class C: public virtual A
{
 public:
 C(){};
 ~C(){};
};


I compile with normal options and link without any difficulty however when I go
to run the application under Windows3.1 an immediate error message is displayed
saying:

 An error has occured in your application. If you choose Ignore, you should
 save your work in a new file.  If you choose Close, your apllication will terminate.

 After selecting Close, I get another error dialog stating

 Application caused a General Protection Fault in module app.exe at 0001:0096

As a side note,  I create a seperate project without the use of the MFC class information
and the exact same code works.