title: C# Abstract Class Operator Overload
body: <p>I have an abstract class, Vector, which I would like to overload the operators +,-,*, etc.<br>
  I want any derived classes to be able to use these, and get an object back with the same type as the calling object.<br>
  I tried with generics, (as follows, in brief), but I couldn't find a legal way to do it:</p>
  
  <pre><code>public static T operator +&lt;T&gt;( T V1, T V2) where T : Vector
  {
       //some calculation
       return new T(args);
  }
  </code></pre>
  
  <p>I then tried to do it just using the base class:</p>
  
  <pre><code>    public static Vector operator+(Vector V1, Vector V2)
      {
          if (V1.Dimension != V2.Dimension)
              throw new VectorTypeException("Vector Dimensions Must Be Equal");
          double[] ArgList = new double[V1.Dimension];
          for (int i = 0; i &lt; V1.Dimension; i++) { ArgList[i] = V1[i] + V2[i]; }
  
          return (Vector)Activator.CreateInstance(V1.GetType(), new object[] { ArgList});
      }
  </code></pre>
  
  <p>If this method is passed in two child objects, it should perform the operation on them, and return a new object of the same heritage.  </p>
  
  <p>The problem I ran into with this is that I cannot enforce that all such child classes must have a constructor with the appropriate signature, and I can't call the base constructor to make the object.</p>
  
  <p>What are ways to either (a) Make either of these work, or (b) do this elegantly in another way?</p>