#78846 - LOst? - Mon Apr 10, 2006 4:13 am
I have programmed a C++ class that is used to handle enemies in my game. The class is being inherited from a standard object class, with a few overloadable virtals and some extended variables and methods.
Now, it would be really easy to spawn an enemy using the operator new.
So here comes my question. If I want to use static memory instead of dynamic memory. How do I do?
I want to create multiple instances of an enemy, or other objects. I don't really know the size of the class. But what about making a static memory area and by force casting a class to it? Is it possible?
What options do I have? Can I overload the operator new in some way? Can I cast classes to a memory area?
_________________
Exceptions are fun
Now, it would be really easy to spawn an enemy using the operator new.
So here comes my question. If I want to use static memory instead of dynamic memory. How do I do?
I want to create multiple instances of an enemy, or other objects. I don't really know the size of the class. But what about making a static memory area and by force casting a class to it? Is it possible?
What options do I have? Can I overload the operator new in some way? Can I cast classes to a memory area?
_________________
Exceptions are fun