Skip to content

Instantly share code, notes, and snippets.

@Strelok78
Last active June 9, 2025 15:52
Show Gist options
  • Select an option

  • Save Strelok78/8447eb64635ec830f1b36fa7d2cf21eb to your computer and use it in GitHub Desktop.

Select an option

Save Strelok78/8447eb64635ec830f1b36fa7d2cf21eb to your computer and use it in GitHub Desktop.
class and constructor practice
using System;
using System.IO;
namespace iJuniorPractice
{
class Program
{
static void Main(string[] args)
{
Player player = new Player(1, 1, '@');
Drawer drawer = new Drawer();
drawer.DrawPlayer(player);
}
}
class Player
{
public Player(int xPosition, int yPosition, char symbol)
{
XAxis = xPosition;
YAxis = yPosition;
Symbol = symbol;
}
public int XAxis { get; }
public int YAxis { get; }
public char Symbol { get; }
}
class Drawer
{
public void DrawPlayer(Player player)
{
Console.SetCursorPosition(player.XAxis, player.YAxis);
Console.Write(player.Symbol);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment