Advertisement
Guest User

Untitled

a guest
Jun 5th, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace DefiningClasses
  6. {
  7. public class Person
  8. {
  9. private string name;
  10. private int age;
  11.  
  12. public Person()
  13. {
  14. Age = 1;
  15. Name = "No name";
  16. }
  17. public Person(int age)
  18. : this()
  19. {
  20. this.Age = age;
  21.  
  22. }
  23.  
  24. public Person(string name, int age)
  25. : this(age)
  26.  
  27. {
  28. this.Name = name;
  29.  
  30. }
  31. public string Name
  32. {
  33. get { return this.name; }
  34. set { this.name = value; }
  35. }
  36.  
  37. public int Age
  38. {
  39. get { return this.age; }
  40. set { this.age = value; }
  41.  
  42. }
  43.  
  44.  
  45.  
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement