using System; class TwoD{ public int x{private get;set;} public int y{get;set;} public void show() { Console.WriteLine(""+x+" "+y); }}class MainClass{ static void Main() { TwoD t1 = new TwoD(); t1.x = 1; t1.y = t1.x + 1; t1.show(); }}
Standard input is empty
prog.cs(19,27): error CS0271: The property or indexer `TwoD.x' cannot be used in this context because the get accessor is inaccessible prog.cs(5,30): (Location of the symbol related to previous error) Compilation failed: 1 error(s), 0 warnings
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!