Advertisement
SnowPhoenix347

5.1

Nov 7th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. using System;
  2.  
  3. namespace FifthProject
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             RendererUi renderer = new RendererUi(1, 12, 100, 4, 5);
  10.            
  11.             renderer.renderUi();
  12.         }
  13.     }
  14.  
  15.     class Player
  16.     {
  17.         protected int Id;
  18.         protected int Level;
  19.         protected int Balance;
  20.  
  21.         public Player(int id, int level, int balance)
  22.         {
  23.             Id = id;
  24.             Level = level;
  25.             Balance = balance;
  26.         }
  27.     }
  28.  
  29.     class RendererUi : Player
  30.     {
  31.         private int _coordinateX;
  32.         private int _coordinateY;
  33.  
  34.         public RendererUi(int id, int level, int balance, int coordinateX, int coordinateY) : base(id, level, balance)
  35.         {
  36.             _coordinateX = coordinateX;
  37.             _coordinateY = coordinateY;
  38.         }
  39.  
  40.         public void renderUi()
  41.         {
  42.             Console.SetCursorPosition(_coordinateX, _coordinateY);
  43.             Console.WriteLine($"id: {Id}\t" +
  44.                               $"level: {Level}\t" +
  45.                               $"balance: {Balance}\t");
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement