Advertisement
VodVas

Работа с классами

Sep 14th, 2023 (edited)
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | Software | 0 0
  1. namespace Работа_с_классами
  2. {
  3.     internal class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             Player player = new Player("Alex", 2700, 18);
  8.  
  9.             player.ShowInfo();
  10.         }
  11.     }
  12.  
  13.     class Player
  14.     {
  15.         string _name;
  16.         private int _mmr;
  17.         private int _age;
  18.  
  19.         public Player(string name, int mmr, int age)
  20.         {
  21.             _age = age;
  22.             _name = name;
  23.             _mmr = mmr;
  24.         }
  25.  
  26.         public void ShowInfo()
  27.         {
  28.             Console.WriteLine($"Имя: {_name} | mmr: {_mmr} | возраст: {_age}") ;
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement