fork download
  1. using System;
  2. using System.Numerics;
  3.  
  4. namespace HelloApp1
  5. {
  6. class Cat
  7. {
  8. public Cat() {}
  9. public Cat(string name, int age, string hair, string color, int weight)
  10. {
  11. this.name = name;
  12. this.age = age;
  13. this.hair = hair;
  14. this.color = color;
  15. this.weight = weight;
  16. }
  17.  
  18. public string name;
  19. public int age;
  20. public string hair;
  21. public string color;
  22. public int weight;
  23.  
  24. public void GetInfo() =>
  25. Console.WriteLine(
  26. $"Имя: {name} возраст: {age} пушистость: {hair} цвет: {color} вес: {weight}кг");
  27. }
  28. class Program
  29. {
  30. static void Main(string[] args)
  31. {
  32. Cat Pshik =
  33. new Cat() { name = "Пшик", age = 3, hair = "пушистый", color = "серый", weight = 5 };
  34. Pshik.GetInfo();
  35.  
  36. Cat Kote =
  37. new Cat("Котэ", 9, "гладкошёрстный", "чёрно-белый", 5);
  38. Kote.GetInfo();
  39. }
  40. }
  41. }
Success #stdin #stdout 0.02s 16120KB
stdin
Standard input is empty
stdout
Имя: Пшик возраст: 3 пушистость: пушистый цвет: серый вес: 5кг
Имя: Котэ возраст: 9 пушистость: гладкошёрстный цвет: чёрно-белый вес: 5кг