fork download
  1. using System;
  2.  
  3. public class Device
  4. {
  5. internal string name;
  6. public string Name
  7. {
  8. get { return name;}
  9. }
  10.  
  11. private Device()
  12. {
  13. }
  14.  
  15. static internal Device NewDevice()
  16. {
  17. return new Device();
  18. }
  19. }
  20.  
  21. public class DeviceManager
  22. {
  23. public static Device OpenDevice()
  24. {
  25. Device d = Device.NewDevice();
  26. d.name = "my friend!";
  27. return d;
  28. }
  29. }
  30.  
  31. public class Test
  32. {
  33.  
  34.  
  35. public static void Main()
  36. {
  37. // your code goes here
  38. Device d = DeviceManager.OpenDevice();
  39. Console.WriteLine(d.Name);
  40. d = new Device();
  41. }
  42. }
Compilation error #stdin compilation error #stdout 0s 131520KB
stdin
Standard input is empty
compilation info
prog.cs(40,7): error CS0122: `Device.Device()' is inaccessible due to its protection level
prog.cs(11,13): (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty