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