Advertisement
asvd32

class player

Jun 6th, 2022
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Collections.Generic;
  4.  
  5. namespace ConsoleApp3
  6. {
  7.     internal class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             Player user = new Player("Иван", "Трубодур", 100);
  12.             user.PrintInfo();
  13.         }
  14.     }
  15.     class Player
  16.     {
  17.         private string _playerName;
  18.         private string _playerClass;
  19.         private int _playerHealhf;
  20.  
  21.         public Player(string playerName, string playerClass, int playerHealhf)
  22.         {
  23.             _playerName = playerName;
  24.             _playerClass = playerClass;
  25.             _playerHealhf = playerHealhf;
  26.         }
  27.         public void PrintInfo()
  28.         {
  29.             Console.WriteLine($"Имя игрока: {_playerName}\nКласс игрока: {_playerClass}\nЖизни игрока: {_playerHealhf}");
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement