Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Homework38
- {
- class Program
- {
- static void Main(string[] args)
- {
- Player player1 = new Player("player1", 100, 10, 20);
- Player player2 = new Player("PlAyEer2", 110, 30, 10);
- player1.ShowInfo();
- Console.Write("\n");
- player2.ShowInfo();
- }
- }
- class Player
- {
- private static int s_identifications = 0;
- private int _identification;
- private string _nickname;
- private int _health;
- private int _damage;
- private int _armor;
- public Player(string nickname, int health, int damage, int armor)
- {
- _identification = ++s_identifications;
- _nickname = nickname;
- _health = health;
- _damage = damage;
- _armor = armor;
- }
- public void ShowInfo()
- {
- Console.WriteLine($"Идентификатор: {_identification}\nНикнейм: {_nickname}\nЗдоровье: {_health}\nУрон: {_damage}\nБроня: {_armor}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement