pol9na

Работа с классами

Mar 30th, 2020
52
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. namespace Study
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             Magician magician = new Magician(100, 0, 20, 2);
  13.             magician.ShowInfo();
  14.             Console.ReadKey();
  15.         }
  16.     }
  17.     class Magician
  18.     {
  19.         public int Health;
  20.         public int Armor;
  21.         public int Damage;
  22.         public int Mana;
  23.         public Magician(int health, int armor, int damage, int mana)
  24.         {
  25.             Health = health;
  26.             Armor = armor;
  27.             Damage = damage;
  28.             Mana = mana;
  29.         }
  30.         public void ShowInfo()
  31.         {
  32.             Console.WriteLine("Характеристики класса маг");
  33.             Console.WriteLine("Жизнь: " + Health+ "\nБроня: " + Armor+ "\nУрон: " + Damage+ "\nМана: " + Mana);
  34.         }
  35.     }
  36. }
Add Comment
Please, Sign In to add comment