Askor

Hw28

Nov 19th, 2020 (edited)
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using System;
  2.  
  3. namespace OOP
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Player player = new Player(10, 2, 5);
  10.             player.ShowStats();
  11.         }
  12.     }
  13.  
  14.     class Player
  15.     {
  16.         private int _health;
  17.         private int _damage;
  18.         private int _lvl;
  19.  
  20.         public Player(int health, int damage, int lvl)
  21.         {
  22.             _health = health;
  23.             _damage = damage;
  24.             _lvl = lvl;
  25.         }
  26.  
  27.         public void ShowStats()
  28.         {
  29.             Console.WriteLine($"HP: {_health}, DMG: {_damage}, LVL: {_lvl}");
  30.         }
  31.     }
  32. }
  33.  
Add Comment
Please, Sign In to add comment