| 1 | using System; |
| 2 | |
| 3 | namespace BrokenOverrideProperty |
| 4 | { |
| 5 | abstract class BaseClass |
| 6 | { |
| 7 | protected BaseClass (string text) |
| 8 | { |
| 9 | Whatever = text; |
| 10 | } |
| 11 | |
| 12 | public virtual string Whatever { get; set; } |
| 13 | } |
| 14 | |
| 15 | class DerivedClass : BaseClass |
| 16 | { |
| 17 | public string CalledValue; |
| 18 | |
| 19 | public DerivedClass (string text) : base (text) |
| 20 | { |
| 21 | } |
| 22 | |
| 23 | public override string Whatever { |
| 24 | get { |
| 25 | return "DerivedClass"; |
| 26 | } |
| 27 | set { |
| 28 | CalledValue = value; |
| 29 | Console.WriteLine ("set called with {0}", value); |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | class MainClass |
| 35 | { |
| 36 | public static int Main () |
| 37 | { |
| 38 | var klass = new DerivedClass ("test-value"); |
| 39 | if (klass.CalledValue != "test-value") |
| 40 | return 1; |
| 41 | |
| 42 | return 0; |
| 43 | } |
| 44 | } |
| 45 | } |