Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. using System;
  2. namespace MyLib
  3. {
  4. public class Person
  5. {
  6. private int age=34;
  7. public int Age
  8. {
  9. get
  10. {
  11. return age;
  12. }
  13. }
  14. public string name;
  15. public void GetInfo()
  16. {
  17. Console.WriteLine("Возраст {0} Имя {1}", age, name);
  18. }
  19. }
  20. }
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. using System;
  28. using MyLib;
  29. namespace ConsoleApplication2
  30. {
  31. class Program
  32. {
  33. static void Main(string[] args)
  34. {
  35. Person tom = new Person();
  36. tom.GetInfo();
  37. tom.name = "Tom";
  38. int age=tom.Age;
  39. tom.GetInfo();
  40. Console.ReadKey();
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement