title: C# abstract class static field inheritance
body: <p>I feel like I skipped a C# class or two, but here's my dilemma:</p>
  
  <p>I have an abstract class from which I derive multiple child classes.</p>
  
  <p>I know for sure that for each of the child classes I will have a constructor that needs a certain static object as a model and this object will be different for each of the child classes.</p>
  
  <p>My first approach was to make a public static object in the abstract parent class and then, before I start creating any instances of the child classes, I would modify it for each of them, but it turns out that this way I actually make only ONE static object, for the abstract class, and each of it's child classes uses it.</p>
  
  <p>How could I solve the problem?</p>
  
  <p>To be more exact, here is the pseudocode:</p>
  
  <p>The parent abstract class:</p>
  
  <pre><code> abstract class AbstractClass
  {
     static public ModelObject Model;
     ...
  }
  </code></pre>
  
  <p>One of the child classes:</p>
  
  <pre><code>class Child : AbstractClass
  {
      ...
      public Child()
      {
          this.someField = Model.someField;
      }
  }
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>The Model needs to be a member of the "ModelObject" class, it should NOT be a singleton or anything else.</p>
  
  <p>EDIT2:</p>
  
  <p>To be even more exact, i chose this implementation for a game of chess: I have an abstract class for the chess pieces and the child classes represent the concrete pieces of the game: pawns, knights, et cetera.</p>
  
  <p>The abstract class inherits from MeshMatObject, a class that represents generic 3d objects with the basic functionality, like rotations, meshes, materials, textures and so on and it defines abstract methods for chess game pieces, like GetPossibleMoves(). </p>
  
  <p>The Model object I was talking about above is a member of the MeshMatObject and, in my opinion, should be defined outside the class just once and then used for all the pieces. I mean: for example all the pawns have the same mesh and texture, so I don't see the point of giving a model as a parameter every time you want to make a pawn.</p>