Advertisement
GPbl3YH

CSLight #28

Feb 4th, 2021
643
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.84 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 CSLight
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Player player = new Player("Макар", "GPbl3YH");
  14.             player.ShowInfo();
  15.         }    
  16.     }
  17.  
  18.     class Player
  19.     {
  20.         private string _name;
  21.         private int _level;
  22.         private string _nickname;
  23.  
  24.         public Player(string name, string nickname, int level = 0)
  25.         {
  26.             _name = name;
  27.             _nickname = nickname;
  28.             _level = level;
  29.         }
  30.  
  31.         public void ShowInfo()
  32.         {
  33.             Console.WriteLine($"Имя - {_name},\nИгровой ник - {_nickname}\nУровень - {_level}");
  34.             Console.ReadKey();
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement