Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Person
- {
- public string Name { get; private set; }
- public int Age { get; private set; }
- public string Phone { get; private set; }
- public Person(string name, int age, string phone)
- {
- Name = name;
- Age = age;
- Phone = phone;
- }
- public void PrintContactInfo()
- {
- Console.WriteLine($"{Name} ({Age}) - {Phone}");
- }
- public void UpdatePhone(string phone)
- {
- Phone = phone;
- }
- public override string ToString()
- {
- return String.Format($"{Name} ({Age}) - {Phone}");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment