I created a small custom class in c# to store the data for a playing card:
public class Card
{
public string suit { get; set; }
public int number { get; set; }
public string val
{
get
{
return number+" of "+suit;
}
}
}
If a had a variable of type Card, and just printed card.toString(), it would print the namespace, window name, and class name. Is there a way I can have the value val print out just by referencing card?
Use the
overridekeyword.