Created
September 20, 2016 07:15
-
-
Save anonymous/2d1770500fa7530f704c361bd8f303e8 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
| /********* | |
| * This Gist was created at CSharpPad.com | |
| * To run this file, open http://csharppad.com/gist/f075352ee464c737ee84d5545655c7a7 | |
| **********/ | |
| public class Person | |
| { | |
| public string Name { get; set; } | |
| private int _age; | |
| public int Age | |
| { | |
| get { return _age; } | |
| set { _age = value; } | |
| } | |
| public Person(string name, int age) | |
| { | |
| Name = name; | |
| Age = age; | |
| } | |
| } | |
| public class ChatPerson: Person | |
| { | |
| private const string DefaultMessage = "default message"; | |
| private string _message; | |
| public ChatPerson(string name, int age) : base(name, age) | |
| { | |
| _message = DefaultMessage; | |
| } | |
| public ChatPerson(string message) : this("John", 42) | |
| { | |
| _message = message; | |
| } | |
| } | |
| var person = new ChatPerson("hello"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment