Advertisement
vovanhik_24

#38

Sep 27th, 2023
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1.         static void Main(string[] args)
  2.         {
  3.             Player firstPlayer = new Player("Vladimir", 21, 101);
  4.             firstPlayer.ShowInfo();
  5.         }
  6.  
  7.         class Player
  8.         {
  9.             private string _name;
  10.             private int _age;
  11.             private int _id;
  12.  
  13.             public Player(string name, int age, int id)
  14.             {
  15.                 _name = name;
  16.                 _age = age;
  17.                 _id = id;
  18.             }
  19.  
  20.             public void ShowInfo()
  21.             {
  22.                 Console.WriteLine($"Ваше имя: {_name}\nВаш возраст: {_age}\nВаш id: {_id}");
  23.             }
  24.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement