Advertisement
TeT91

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

May 26th, 2024
635
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.35 KB | None | 0 0
  1. using System;
  2.  
  3. namespace CSLight
  4. {
  5.     class Player
  6.     {
  7.         private string _name;
  8.         private int _health;
  9.  
  10.         public Player(string name, int health)
  11.         {
  12.             _name = name;
  13.             _health = health;
  14.         }
  15.         public void ShowInfo()
  16.         {
  17.             Console.WriteLine("Игрок - " + _name + "HP - " + _health);
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement