Created
April 5, 2016 23:38
-
-
Save luuhq/6323d0b9d70e25db2e40487850e0c227 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Child1: {0}", new Child1().Caller); | |
Console.WriteLine("Child2: {0}", new Child2().Caller); | |
Console.WriteLine("Child3: {0}", new Child3().Caller); | |
} | |
public abstract class Parent | |
{ | |
public Parent([CallerMemberName] string caller = "Default") | |
{ | |
Caller = caller; | |
} | |
public string Caller { get; private set; } | |
} | |
public class Child1 : Parent | |
{ | |
} | |
public class Child2 : Parent | |
{ | |
public Child2() | |
{ | |
} | |
} | |
public class Child3 : Parent | |
{ | |
public Child3() | |
: base() | |
{ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment