Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Working_with_properties
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- Player davide = new Player(3, 2);
- Drawer renderer = new Drawer();
- renderer.DrawUser(davide);
- }
- }
- class Player
- {
- public Player(int positionX, int positionY, char symbol = '@')
- {
- PositionX = positionX;
- PositionY = positionY;
- Symbol = symbol;
- }
- public int PositionX { get; private set; }
- public int PositionY { get; private set; }
- public char Symbol { get; private set; }
- }
- class Drawer
- {
- public void DrawUser(Player user)
- {
- Console.SetCursorPosition(user.PositionX, user.PositionY);
- Console.Write(user.Symbol);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment