fork download
  1. using System;
  2.  
  3. class TwoD
  4. {
  5. public int x{private get;set;}
  6. public int y{get;set;}
  7.  
  8. public void show()
  9. {
  10. Console.WriteLine(""+x+" "+y);
  11. }
  12. }
  13. class MainClass
  14. {
  15. static void Main()
  16. {
  17. TwoD t1 = new TwoD();
  18. t1.x = 1;
  19. t1.y = t1.x + 1;
  20. t1.show();
  21. }
  22. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
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
stdout
Standard output is empty