lovelyvook

Unit_37

Jul 11th, 2024
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Ijunior
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Player player01 = new Player("Мария", 20, 2);
  10.             Player player02 = new Player("Роман", 30, 3);
  11.             Player player03 = new Player("Ирина", 40, 4);
  12.  
  13.             player01.ShowInfo();
  14.             player02.ShowInfo();
  15.             player03.ShowInfo();
  16.         }
  17.     }
  18.  
  19.     class Player
  20.     {
  21.         private string _name;
  22.         private int _age;
  23.         private int _level;
  24.  
  25.         public Player(string name, int age, int level)
  26.         {
  27.             _name = name;
  28.             _age = age;
  29.             _level = level;
  30.         }
  31.  
  32.         public void ShowInfo()
  33.         {
  34.             Console.WriteLine($"Имя: {_name} || Возраст: {_age} || Уровень: {_level}");
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment