Compile time error C4407

We have the following class structure in our code

Class A: public CDialog, public Base1, public Base2
{
};

In the implementation of class A, we have the following:

BEGIN_MESSAGE_MAP( A, CDialog )
    ON_WM_SIZE()
END_MESSAGE_MAP()

Note: Base1 and Base2 are not inherited from CDialog or other MFC classes.

In VC6, compilation was successful. But on VC9 we get the following error code:

error C4407: discarded between different pointers to representations of participants, the compiler may generate incorrect code .

This error code indicates the location of ON_WM_SIZE.

Can anyone tell me a solution. Thanks in advance.

Player

+3
source share
4 answers

I just solved an instance of this problem; found this question using web search.

, : CDialog ConfigurationTab, . , :

class Foo : public ConfigurationTab, public CDialog

:

class Foo : public CDialog, public ConfigurationTab

, ON_BN_CLICKED DDX. DDX , , .

+3

V9, , VS6 VC8 ON_WM_SIZE , , . VC6 C casts, VC8 ++ casts, .

OnSize, , , , .

+2

, , MFC, ,

BEGIN_MESSAGE_MAP (, )

'', A , , , ?

+1

Base2 . .

class Base2
{
 virtual void method(){};
}

,

Class A: public CDialog, public Base1, public virtual Base2
{
};

A.

virtual.

Class A: public CDialog, public Base1, public Base2
{
};

. : Base2. A.

Hope this helps you.

0
source

Source: https://habr.com/ru/post/1729526/


All Articles