Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Person
- {
- protected int[] a = new int[10];
- public int this [int index]
- {
- get { return a[index]; }
- set { a[index] = value; }
- }
- protected int age;
- protected string name, surname;
- protected static int ID = 0;
- public int Age
- {
- get { return age; }
- set {
- // if (value < 0) throw new ArgumentOutOfRangeException();
- if (value < 0)
- value = 0;
- age = value;
- }
- }
- public Person(int age, string name, string surname)
- {
- ID++;
- this.Age = age;
- this.name = name;
- this.surname = surname;
- }
- public void getInfromation()
- {
- Console.WriteLine("Age = " + age);
- Console.WriteLine("Name = " + name);
- Console.WriteLine("Surname = " + surname);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement