Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CObject

CObject

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++visual-studiomcp
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gagnon Claude
    wrote on last edited by
    #1

    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

    C R S 3 Replies Last reply
    0
    • G Gagnon 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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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

      R 1 Reply Last reply
      0
      • G Gagnon 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

        R Offline
        R Offline
        Ryan Binns
        wrote on last edited by
        #3

        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"

        1 Reply Last reply
        0
        • C Christian Graus

          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

          R Offline
          R Offline
          Ryan Binns
          wrote on last edited by
          #4

          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"

          1 Reply Last reply
          0
          • G Gagnon 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

            S Offline
            S Offline
            Serge Krynine
            wrote on last edited by
            #5

            wouldn't the following be better ? class CPoteauBeton : public CObject {}; class CVerifiPoteau : public CPoteauBeton {}; Serge

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups