Skip to content

Instantly share code, notes, and snippets.

@snippe
Created December 5, 2014 05:35
Show Gist options
  • Save snippe/95bb55191b1e4880dd76 to your computer and use it in GitHub Desktop.
Save snippe/95bb55191b1e4880dd76 to your computer and use it in GitHub Desktop.
class BaseClass
{
public virtual string Name { get; set; }
}
class DerivedClass : BaseClass
{
public override string Name
{
get
{
return base.Name;
}
set
{
base.Name = value + " X";
}
}
}
class Program
{
static void Main(string[] args)
{
BaseClass c1 = new BaseClass { Name = "c1" }; //Name will be c1
DerivedClass c2 = new DerivedClass { Name = "c2" }; //Name will be c2 X
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment