CObject
-
Hi, When I have designed my application, I had a class (CVerifiPoteau) that was inheriting from a base class (CPoteauBeton). Now I want to serialize my class CVerifiPoteau and I have added another inherited class : CObject. See my code here : class CVerifiPoteau : public CPoteauBeton , public CObject It seems to work properly since it respect C++, but I want to know if it can cause some difficulties with MFC (Visual Studio.NET 2003 C++). Thanks, Claude
-
Hi, When I have designed my application, I had a class (CVerifiPoteau) that was inheriting from a base class (CPoteauBeton). Now I want to serialize my class CVerifiPoteau and I have added another inherited class : CObject. See my code here : class CVerifiPoteau : public CPoteauBeton , public CObject It seems to work properly since it respect C++, but I want to know if it can cause some difficulties with MFC (Visual Studio.NET 2003 C++). Thanks, Claude
Why would using a class that comes with MFC cause problems in MFC ? Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
-
Hi, When I have designed my application, I had a class (CVerifiPoteau) that was inheriting from a base class (CPoteauBeton). Now I want to serialize my class CVerifiPoteau and I have added another inherited class : CObject. See my code here : class CVerifiPoteau : public CPoteauBeton , public CObject It seems to work properly since it respect C++, but I want to know if it can cause some difficulties with MFC (Visual Studio.NET 2003 C++). Thanks, Claude
Although it shouldn't make a difference, the MSVC++6 compiler was dependent on the order in which the classes appeared in the derivation list for multiple inheritance. Consequently, it often caused very wierd runtime errors if the MFC class was not the first class in the derivation list. As a general rule, make the MFC class the first class in the derivation list (swap the two around in your example above) and it should work fine. I don't know whether the same problem appears in the .NET 2003 compiler, but I would still put the MFC class first.
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
Why would using a class that comes with MFC cause problems in MFC ? Christian I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
Christian Graus wrote: Why would using a class that comes with MFC cause problems in MFC ? Multiple inheritance and MFC does not mix particularly well :) See my answer below for the problem that I found.
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
Hi, When I have designed my application, I had a class (CVerifiPoteau) that was inheriting from a base class (CPoteauBeton). Now I want to serialize my class CVerifiPoteau and I have added another inherited class : CObject. See my code here : class CVerifiPoteau : public CPoteauBeton , public CObject It seems to work properly since it respect C++, but I want to know if it can cause some difficulties with MFC (Visual Studio.NET 2003 C++). Thanks, Claude
wouldn't the following be better ? class CPoteauBeton : public CObject {}; class CVerifiPoteau : public CPoteauBeton {}; Serge