|
-
Nov 8th, 2004, 10:54 PM
#1
Thread Starter
PowerPoster
Static Array in Abstract - Load Once?
Alright, I have an abstract class MoveableObject, within it contains a static array type D3DVECTOR and a static function to generate the lookup table for 3d movement.
The array is static, so that means even if 1 million units where created using the class MoveableObject, there would still be only 1 instance of the static array?
MoveableObject <-- Human
MoveableObject <-- Tank
Still only 1 instance of the static D3DVECTOR?
Edit:
What about a static class instance?
I have a static struct, and a static array it must declared:
MoveableObject::UV_TABLE MoveableObject::VectorCircle[360];
Is this correct?
Last edited by Halsafar; Nov 8th, 2004 at 11:10 PM.
"From what was there, and was meant to be, but not of that was faded away." - - Steve Damm
"The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm
"When you do things right, people won't be sure if you did anything at all." - - God from Futurama
-
Nov 9th, 2004, 11:37 AM
#2
The array is static, so that means even if 1 million units where created using the class MoveableObject, there would still be only 1 instance of the static array?
That's correct.
What about a static class instance?
What's that? You mean a file-level object of a class declared with the static keyword?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Nov 9th, 2004, 05:11 PM
#3
Thread Starter
PowerPoster
Yah, for example:
#include <clsSfxEngine.hpp>
class MoveableObject
{
protected:
static SfxEngine SFX;
};
class Human : public MoveableObject
{
};
//in a function
Human Player;
Player.SFX.Play();
Now no matter how many millions of objects need to use that instance of the sfx engine, it will still be only one?
"From what was there, and was meant to be, but not of that was faded away." - - Steve Damm
"The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm
"When you do things right, people won't be sure if you did anything at all." - - God from Futurama
-
Nov 9th, 2004, 05:17 PM
#4
Yes, there will be only one.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|