VIzlo

Task ООП 1

Jun 9th, 2023 (edited)
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | Gaming | 0 0
  1. namespace ConsoleApp2
  2. {
  3.     internal class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             Player player = new Player();
  8.             player.ShowInfo();
  9.         }
  10.     }
  11.  
  12.     class Player
  13.     {
  14.         private string _namePlayer;
  15.         private int _healthPlayer;
  16.         private int _balanceMoneyPlayer;
  17.  
  18.         public Player()
  19.         {
  20.             _namePlayer = "Дмитрий";
  21.             _healthPlayer = 100;
  22.             _balanceMoneyPlayer = 1500;
  23.         }
  24.  
  25.         public void ShowInfo()
  26.         {
  27.             Console.WriteLine($" Характеристики игрока {_namePlayer} равны: \n Здоровье {_healthPlayer} \n Баланс {_balanceMoneyPlayer}$");
  28.             Console.ReadKey();
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment