Advertisement
RedFlys

Home Work 5.1

Nov 14th, 2019
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 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 ConsoleApp3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Player RedFly = new Player("RedFly", "80", "Warrior");            
  14.  
  15.             RedFly.WriteInfo();
  16.             Console.ReadKey();
  17.         }    
  18.     }
  19.  
  20.     class Player
  21.     {
  22.         public string Nickname;
  23.         public string Level;
  24.         public string GameClass;
  25.  
  26.         public Player(string nickname, string level, string gameClass)
  27.         {
  28.             Nickname = nickname;
  29.             Level = level;
  30.             GameClass = gameClass;
  31.         }
  32.  
  33.         public Player()
  34.         {
  35.             Nickname = "noname";
  36.             Level = "1";
  37.             GameClass = "Knight";
  38.         }
  39.  
  40.         public void WriteInfo()
  41.         {
  42.             Console.WriteLine($"Ваш ник: {Nickname}. \nУровень персонажа: {Level}. \nКласс персонажа: {GameClass}");
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement