Created
December 5, 2014 05:35
-
-
Save snippe/95bb55191b1e4880dd76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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