Last active
December 4, 2025 19:00
-
-
Save Attosius/8c8eff37f3b4c623f3d9215c4a80b7c6 to your computer and use it in GitHub Desktop.
ДЗ: Работа с классами
This file contains hidden or 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 IJuniorTasks | |
| { | |
| internal class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var player = new Player("Player1", 10, 5); | |
| player.ShowInformation(); | |
| } | |
| } | |
| public class Player | |
| { | |
| private string _name; | |
| private int _damage; | |
| private int _speed; | |
| public Player(string name, int damage, int speed) | |
| { | |
| _name = name; | |
| _damage = damage; | |
| _speed = speed; | |
| } | |
| public void ShowInformation() | |
| { | |
| Console.WriteLine($"Name: {_name}, Damage: {_damage}, Speed: {_speed}"); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment