Constructors

This is code that is run when an object is created. It's generally used to initialise values and invoke any methods that need to run for every new object.

For instance if I wanted to construct a new Card in a card game and then load the values for that card afterwards I could write something like this:

public class Card
{
	int manaCost;
	int attackPower;
	int health;
	
	public Card(CardStats stats)
	{
		manaCost = stats.cost;
		attackPower = stats.damage;
		health = stats.health;
	}

//Common card methods e.g. PlayCard, Attack, Taunt etc

}
class DeckManager
{
	class internal CardStats 
	{
		public int cost;
		public int damage;
		public int health;
	}

	public CardStats defaultStats;

	private List<Card> cards = new List<Card(CardStats)>;

	private void DisplayCards() 
	{
		//Display defaults 
	}

}