Advertisement
danzylrabago

private

Mar 31st, 2020
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. using System;
  2.  
  3. class Dog
  4. {
  5. //class members without the keyword public are by default considered private
  6. public static string name = "lucy";
  7. public static string gender = "female";
  8. public static int size = 5;
  9. public static bool healthy = true;
  10. public static int age = 2;
  11. };
  12.  
  13. class PrivateExample
  14. {
  15. static void Main()
  16. {
  17.  
  18. Console.WriteLine(Dog.age);
  19. Console.WriteLine(Dog.name);
  20. Console.WriteLine(Dog.gender);
  21. Console.WriteLine(Dog.size);
  22. Console.WriteLine(Dog.healthy);
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement