CPChar and CPCharAbilities. CPChar is the container class for all of my character code. Inherited from this will be my NPC class and my PC class in an online roleplaying game.
Class CPChar {
private:
CPCharAbilities *abilities;
public:
...
}
Class CPCharAbilities {
private:
int str;
int dex;
int ...
public:
void RerollStats();
inline int GetSTR() {return (str);}
...
}
Two questions from this and pardon the syntax if it is not correct as I did this from my head. If I instantiate a PChar say 15000 times representing the number of individual monsters and player characters in the game at one time, will the RerollStats function get instantiated 15,000 times as well or will the compiler optimize this by sharing the code in the executable? Also what is the effect of the inline function with respect to the same question. My initial research tells me that the former is instantiated each time and the latter is not as it acts like a #define macro would in C.
If what I am thinking is true is there a way around this while still enjoying the benefits of encapsulation or am I being forced through some C++ scalability limit to revert back to a procedural way of thinking to reduce the memory footprint an object oriented way of thinking would cause. Because this is an online game performance and scalability are of utmost concern.
Thanks
Kressilac
ps I am coding on Win32 for NT 4.0 Svc pack 5. I use Visual Studio 6.0 and have the first service pack installed.
------------------
Derek Licciardi
