title: Can static members be inherited separately?
body: <p>In C++, I have an Object class, from which a number of other classes inherit (ie Ball, Paddle, and Wall). Is there a way to have a static member on the Object class that gets inherited as separate static members by each subclass?</p>
  
  <p>Basically, I want Ball, Paddle, and Wall to each have a static member (used to store images for drawing) that they inherited from Object (since an array to store images is a common requirement across all objects), but the static members are separate for each of Ball, Paddle, and Wall. That way every Ball instance has access to the ball images, every Paddle has access to the paddle images, and so on.</p>
  
  <p>If this isn't possible, what would be a good way to allow similar functionality?</p>
  
  <p>EDIT:</p>
  
  <p>Some more detail on what I'm actually trying to accomplish:</p>
  
  <p>I'm working on a Breakout Clone. I have an Object class, from which all game objects inherit (Ball, Paddle, Block, and Wall). All of these objects have a handful of images that they need access to in order to draw themselves (which is done by Object* to all objects in a std::list and running the virtual method updateAndDraw() on all of them).</p>
  
  <p>Right now, Ball, Paddle, Block, and Wall each have a static sf::Texture (from SFML) array that stores all the images the object would need. It's static because all instances of each class can share the images, and it would be a waste of memory to load them separately for each instance. The images are loaded and stored in the array the first time each of the respective game objects are constructed.</p>
  
  <p>The image loading and storing functionality is basically the same for all the game objects, so I wanted to move it off of each individual game object and on to Object. My plan was to have a static member on Object that each game object will inherit, and this static member will be independent for each of Ball, Paddle, Block, and Wall, although it's looking now like this might not work. I would also have a static method on Object called <code>loadImages(string filenames[])</code>, that would take an array of image filenames and load the images into the static image array for the game object that <code>loadImages()</code> was called on. So in the Ball constructor, if I ran <code>loadImages()</code> and passed it some filenames, it would load the images into the static image array for Ball, and the same (independently) for all the other game objects.</p>
  
  <p>After typing this all up, I'm realizing that it might be better to store the images somewhere else, and just give the game objects pointers to those images. This eliminates the need for the images array to be static, and in the constructor I can just call a function on whatever is storing the images and pass it the object type, and it'll hand me an array of pointers to the images that game object would need.</p>