Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Dog
- {
- //class members without the keyword public are by default considered private
- public static string name = "lucy";
- public static string gender = "female";
- public static int size = 5;
- public static bool healthy = true;
- public static int age = 2;
- };
- class PrivateExample
- {
- static void Main()
- {
- Console.WriteLine(Dog.age);
- Console.WriteLine(Dog.name);
- Console.WriteLine(Dog.gender);
- Console.WriteLine(Dog.size);
- Console.WriteLine(Dog.healthy);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement