Created
June 4, 2025 18:32
-
-
Save Strelok78/cfa583eff30fa0a5219291facf684e11 to your computer and use it in GitHub Desktop.
class and properties lesson
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; | |
| using System.IO; | |
| namespace iJunior_Practice | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| Player player = new Player("Ivan", 30); | |
| player.ShowInfo(); | |
| } | |
| } | |
| class Player | |
| { | |
| public Player(string name, int age) | |
| { | |
| Name = name; | |
| Age = age; | |
| } | |
| public string Name | |
| { | |
| get; | |
| } | |
| public int Age | |
| { | |
| get; | |
| } | |
| public void ShowInfo() | |
| { | |
| Console.WriteLine($"Name: {Name}, Age: {Age}"); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment