fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. private class PeopleInfo_Correct{
  6. private string name;
  7.  
  8. public PeopleInfo_Correct(string name){
  9. this.name = name;
  10. }
  11.  
  12. public string Name {get{return name;}}
  13. }
  14.  
  15. private class PeopleInfo_Wrong{
  16. private string name;
  17.  
  18. public PeopleInfo_Wrong(string name){
  19. // this.name = name;
  20. }
  21.  
  22. public string Name {get{return name;}}
  23. }
  24.  
  25. public static void Main()
  26. {
  27. PeopleInfo_Correct pi_c = new PeopleInfo_Correct("p1");
  28. PeopleInfo_Wrong pi_w = new PeopleInfo_Wrong("p2");
  29.  
  30. Console.WriteLine("pi_c.Name: \"" + pi_c.Name + "\"");
  31. Console.WriteLine("pi_w.Name: \"" + pi_w.Name + "\"");
  32. }
  33. }
Success #stdin #stdout 0.04s 36912KB
stdin
Standard input is empty
stdout
pi_c.Name: "p1"
pi_w.Name: ""