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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Help with inheritance

Help with inheritance

Scheduled Pinned Locked Moved C / C++ / MFC
helpoop
2 Posts 2 Posters 1 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.
  • S Offline
    S Offline
    Sirrius
    wrote on last edited by
    #1

    I am trying to do some simple inheritance with a few classes but keep running into an error at compile time. It is error C2504, 'undefined base class'. What does this mean. My classes are defined, I think they are anyway. This is what it looks like.

    class a{

    };

    class b : public a{

    };

    I am including the files as well. I am just kind of stumped. Thanks Brian.

    J 1 Reply Last reply
    0
    • S Sirrius

      I am trying to do some simple inheritance with a few classes but keep running into an error at compile time. It is error C2504, 'undefined base class'. What does this mean. My classes are defined, I think they are anyway. This is what it looks like.

      class a{

      };

      class b : public a{

      };

      I am including the files as well. I am just kind of stumped. Thanks Brian.

      J Offline
      J Offline
      Jose Cezar S Ynion
      wrote on last edited by
      #2

      Make sure you include the header file of your base class in your derived class. 1. say you defined class a in "a.h" file class a { }; 2. In class b header file #include "a.h" class b: public a { }; Jose Cezar S. Ynion

      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