title: How to define a virtual getter and abstract setter for a property?
body: <p>This is essentially what I want to do:</p>
  
  <pre><code>public abstract class Uniform&lt;T&gt;
  {
      public readonly int Location;
      private T _variable;
  
      public virtual T Variable
      {
          get { return _variable; }
      }
  }
  
  public class UniformMatrix4 : Uniform&lt;Matrix4&gt;
  {
      public override Matrix4 Variable
      {
          set
          {
              _variable = value;
              GL.UniformMatrix4(Location, false, ref _variable);
          }
      }
  }
  </code></pre>
  
  <p>The getter for <code>Variable</code> will be the same across all derived classes, but the setter needs to be different.</p>
  
  <p>In fact... I'd prefer not to have derived classes at all (it's only one function call that will differ for each type) but I can't think of how else to do it.</p>
  
  <hr>
  
  <p><strong>Edit:</strong> If it wasn't clear what the problem I'm having is, I'm getting a syntax error:</p>
  
  <blockquote>
    <p>'UniformMatrix4.Variable.set': cannot override because 'Uniform.Variable' does not have an overridable set accessor</p>
  </blockquote>
  
  <p>And I'm not sure how to create an "overridable set accessor"... <code>virtual</code> and <code>abstract</code> don't seem to be allowed on the setter.</p>