IGRODELOFF

Task38

Jun 20th, 2022 (edited)
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Task38
  8. {
  9.     internal class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Player player = new Player("John",21);
  14.  
  15.             player.ShowInfoPlayer();    
  16.         }
  17.     }
  18.  
  19.     class Player
  20.     {
  21.         private string _name;
  22.         private int _age;
  23.  
  24.         public Player(string name, int age)
  25.         {
  26.             _name = name;
  27.             _age = age;
  28.         }
  29.  
  30.         public void ShowInfoPlayer()
  31.         {
  32.             Console.WriteLine($"Имя игрока - {_name}, его возраст - {_age}");
  33.         }
  34.     }
  35. }
  36.  
Add Comment
Please, Sign In to add comment