vendredi 27 mai 2016

modifying derived class values from base class

Is it possible to have a method in a base class to modify a derived class' properties? I was thinking something like this:

public class baseclass
{
  public void changeProperties(string propertyName, string newValue)
  {
    try
    {
      this.propertyName = newValue;
    }
    catch
    {
      throw new NullReferenceException("Property doesn't exist!");
    }
  }
}





Aucun commentaire:

Enregistrer un commentaire