Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace playerClass
- {
- class Program
- {
- static void Main(string[] args)
- {
- Player player1 = new Player();
- Player player2 = new Player(125, 2, 500);
- Console.WriteLine("Игрок 1:");
- player1.ShowStats();
- Console.WriteLine("\nИгрок 2:");
- player2.ShowStats();
- }
- }
- class Player
- {
- private int _health;
- private int _level;
- private int _experience;
- public Player(int health, int level, int experience)
- {
- _health = health;
- _level = level;
- _experience = experience;
- }
- public Player()
- {
- _health = 100;
- _level = 1;
- _experience = 0;
- }
- public void ShowStats()
- {
- Console.WriteLine("Здоровье - " + _health + "\nУровень - " + _level + "\nОпыт - " + _experience);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement