Created
May 11, 2024 04:42
-
-
Save trayforyou/3ec8eef3bc4be64eec652117ee4cf8c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace OOP_number_1 | |
{ | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Player player = new Player("Ваня",10); | |
player.ShowInfo(); | |
} | |
} | |
class Player | |
{ | |
public string Name { get; private set; } | |
public int Power { get; private set; } | |
public Player(string name, int power) | |
{ | |
Name = name; | |
Power = power; | |
} | |
public void ShowInfo() | |
{ | |
Console.WriteLine($"Игрок {Name} обладает силой в {Power} ед."); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment