Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication2
  8.  
  9. { class person
  10. {
  11. public string name;
  12. public int age;
  13. public person() { name = "неизвестно"; age = 18; }
  14. public person(string n) { name = n; age = 18; }
  15. public person(string n, int a) { name = n; age = a; }
  16. public void GetInfo()
  17. {
  18. Console.WriteLine("Имя:{0} Возвраст: {1}",name, age);
  19. }
  20. }
  21. class Program
  22. {
  23. static void Main(string[] args)
  24. {
  25. person tom = new person();
  26. person bob = new person("bob");
  27. person sam = new person("sam", 25);
  28. tom.GetInfo();
  29. bob.GetInfo();
  30. sam.GetInfo();
  31. Console.ReadKey();
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement