RedFlys

Home work - create class

Nov 12th, 2021
965
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 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 Home_Work
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Player player = new Player("Мугивара Ди Луффи", 500, "Стать королём пиратов");          
  14.  
  15.             player.ShowInfo();
  16.             Console.ReadKey();
  17.         }
  18.     }
  19.  
  20.     class Player
  21.     {
  22.         private string _name;
  23.         private int _power;
  24.         private string _dream;
  25.  
  26.         public Player(string name, int power, string dream)
  27.         {
  28.             _name = name;
  29.             _power = power;
  30.             _dream = dream;
  31.         }
  32.  
  33.         public void ShowInfo()
  34.         {
  35.             Console.WriteLine($"Игрок {_name} получил баф от своей команды на {_power} силы.\n" +
  36.                 $"Его мечта: {_dream}.");
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment