Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Private in C#

Private member can be accessed only in the present class.

  1. using System;
  2. using System.IO;
  3.  
  4. namespace forgetCode
  5. {
  6. class program1
  7. {
  8. private string name = "Forget Code";
  9.  
  10.  
  11. static void Main(string[] args)
  12. {
  13.  
  14. program1 obj = new program1();
  15. Console.WriteLine(obj.name);
  16.  
  17.  
  18. }
  19. }
  20. }


Output:
Forget Code