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. Class of Classes! or #$@%#^#$@$@!!!

Class of Classes! or #$@%#^#$@$@!!!

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++debugginghelp
4 Posts 3 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.
  • C Offline
    C Offline
    CreepingFeature
    wrote on last edited by
    #1

    Hi! I'm going nuts here! Spent a whole week building three huge classes and now got a bright idea...What if I was to organise my classes, def in headers, say cls1.h cls2.h cls3.h (by the by got implementation files .cpp's :doh:), into a neat monster class clsMonster.h! If you didn't understand what happened just now dont worry I still cant figure out why I even had the thought in the first place! The thing is I got these 3 classes that logicaly are a part of a thing that can be a big class on its own. I started developing them separately since they are big but now feel that they would be neater if there was one class containing them sub classes (just jaming every member in clsMonster would be overkill and give me 2000+ lines to debug in one pile! :omg:). I made a new header, defined the big class but now need to access the members of sub classes from main() thru the big class. Problem: Cant figure out the damn syntax of accessing the members of sub classes. eg. .... #include "cls1_H.h" #include "cls2_H.h" #include "cls3_H.h" class Player { blah blah }; ..... #include "Player_H.h" main() { Player myChar; myChar.blah blah(); // this would access members of Player } BUT HOW DO I ACCESS THE HEADERS INCLUDED IN Player.h??? Is there an other way to do this! (main concern - neat groups!!!) If anyone is on this particular line right now, THANKS FOR YOUR TIME! -------------------------------------------------------- DEBUGING IS A BITCH :smiley whith brains blown out: --------------------------------------------------------

    M C C 3 Replies Last reply
    0
    • C CreepingFeature

      Hi! I'm going nuts here! Spent a whole week building three huge classes and now got a bright idea...What if I was to organise my classes, def in headers, say cls1.h cls2.h cls3.h (by the by got implementation files .cpp's :doh:), into a neat monster class clsMonster.h! If you didn't understand what happened just now dont worry I still cant figure out why I even had the thought in the first place! The thing is I got these 3 classes that logicaly are a part of a thing that can be a big class on its own. I started developing them separately since they are big but now feel that they would be neater if there was one class containing them sub classes (just jaming every member in clsMonster would be overkill and give me 2000+ lines to debug in one pile! :omg:). I made a new header, defined the big class but now need to access the members of sub classes from main() thru the big class. Problem: Cant figure out the damn syntax of accessing the members of sub classes. eg. .... #include "cls1_H.h" #include "cls2_H.h" #include "cls3_H.h" class Player { blah blah }; ..... #include "Player_H.h" main() { Player myChar; myChar.blah blah(); // this would access members of Player } BUT HOW DO I ACCESS THE HEADERS INCLUDED IN Player.h??? Is there an other way to do this! (main concern - neat groups!!!) If anyone is on this particular line right now, THANKS FOR YOUR TIME! -------------------------------------------------------- DEBUGING IS A BITCH :smiley whith brains blown out: --------------------------------------------------------

      M Offline
      M Offline
      Michael P Butler
      wrote on last edited by
      #2

      Sorry but your question makes no-sense at all. Can you give an example of what is in cls1_H.h that you are trying to access. The blah blah in Player is a little confusing. A real example would be more helpful to diagnose your issues. Michael CP Blog [^]

      1 Reply Last reply
      0
      • C CreepingFeature

        Hi! I'm going nuts here! Spent a whole week building three huge classes and now got a bright idea...What if I was to organise my classes, def in headers, say cls1.h cls2.h cls3.h (by the by got implementation files .cpp's :doh:), into a neat monster class clsMonster.h! If you didn't understand what happened just now dont worry I still cant figure out why I even had the thought in the first place! The thing is I got these 3 classes that logicaly are a part of a thing that can be a big class on its own. I started developing them separately since they are big but now feel that they would be neater if there was one class containing them sub classes (just jaming every member in clsMonster would be overkill and give me 2000+ lines to debug in one pile! :omg:). I made a new header, defined the big class but now need to access the members of sub classes from main() thru the big class. Problem: Cant figure out the damn syntax of accessing the members of sub classes. eg. .... #include "cls1_H.h" #include "cls2_H.h" #include "cls3_H.h" class Player { blah blah }; ..... #include "Player_H.h" main() { Player myChar; myChar.blah blah(); // this would access members of Player } BUT HOW DO I ACCESS THE HEADERS INCLUDED IN Player.h??? Is there an other way to do this! (main concern - neat groups!!!) If anyone is on this particular line right now, THANKS FOR YOUR TIME! -------------------------------------------------------- DEBUGING IS A BITCH :smiley whith brains blown out: --------------------------------------------------------

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

        CreepingFeature wrote: Spent a whole week building three huge classes First problem. Try to design your structure so your classes are lightweight. CreepingFeature wrote: into a neat monster class clsMonster.h! That's NOT neat, it's a 'monster', a maintenance nightmare. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

        1 Reply Last reply
        0
        • C CreepingFeature

          Hi! I'm going nuts here! Spent a whole week building three huge classes and now got a bright idea...What if I was to organise my classes, def in headers, say cls1.h cls2.h cls3.h (by the by got implementation files .cpp's :doh:), into a neat monster class clsMonster.h! If you didn't understand what happened just now dont worry I still cant figure out why I even had the thought in the first place! The thing is I got these 3 classes that logicaly are a part of a thing that can be a big class on its own. I started developing them separately since they are big but now feel that they would be neater if there was one class containing them sub classes (just jaming every member in clsMonster would be overkill and give me 2000+ lines to debug in one pile! :omg:). I made a new header, defined the big class but now need to access the members of sub classes from main() thru the big class. Problem: Cant figure out the damn syntax of accessing the members of sub classes. eg. .... #include "cls1_H.h" #include "cls2_H.h" #include "cls3_H.h" class Player { blah blah }; ..... #include "Player_H.h" main() { Player myChar; myChar.blah blah(); // this would access members of Player } BUT HOW DO I ACCESS THE HEADERS INCLUDED IN Player.h??? Is there an other way to do this! (main concern - neat groups!!!) If anyone is on this particular line right now, THANKS FOR YOUR TIME! -------------------------------------------------------- DEBUGING IS A BITCH :smiley whith brains blown out: --------------------------------------------------------

          C Offline
          C Offline
          CreepingFeature
          wrote on last edited by
          #4

          Forget it! I think I was sleepwalking ystrday or somthn. Figured the whole thing out. By the way classes are so big due to enums, got lots of them!!!

          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