Page 1 of 1

Would this be better in the actual class?

Posted: Sun Jun 10, 2007 11:15 pm
by earlz
I am making a robot AI thing...well, the AI is stored in an instruction set...I put a robot is in class Robot, now I have begun making a file for executing the instructions..(using a namespace also)...now, the instruction set has to access a robot all the time..therefor you must basically pass a this pointer, but my Robot class is already pretty big..I feel it may be kind of bloated if I were to add the entire instruction set(and parts of the decoder) into the Robot class though ...

what should I do? :?

My only other idea is to use friend classes(is that possible?) but even then, wouldn't you still need to pass a pointer to the current Robot class!?

Posted: Tue Jun 12, 2007 3:10 am
by Kevin McGuire
You might have been able to build a base class with the primitive functionality such as a memory and the interpretor, then derive a advanced robot class from that which supports the sensory and what not.