Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Encapsulation_ver02
- {
- class Program
- {
- static void Main(string[] args)
- {
- Player player = new Player(7, 0);
- Renderer renderer = new Renderer();
- renderer.DrawPlayer(player.LineX, player.LineY, player.Icon);
- }
- class Player
- {
- public int LineX { get; private set; }
- public int LineY { get; private set; }
- public char Icon { get; private set; }
- public Player(int x, int y)
- {
- LineX = x;
- LineY = y;
- Icon = '♂';
- }
- }
- class Renderer
- {
- public void DrawPlayer(int x, int y, char hero = '@')
- {
- Console.SetCursorPosition(x, y);
- Console.WriteLine(hero);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement