I have a structure named "Card" in Codes.cs file which is located in Codes folder of project. The source code of this structure is as follows:
struct Card
{
//Suit that this card belongs to
private CardSuit suit;
public CardSuit Suit
{
get { return suit; }
set { suit = value; }
}
///The value of this card
private CardValue value;
public CardValue Value
{
get { return value; }
set { this.value = value; }
}
public Card(CardSuit s, CardValue v)
{
this.suit = s;
this.value = v;
}
}
enum CardSuit : int { Clubs, Spades, Hearts, Diamonds };
enum CardValue : int { Ace, King, Queen, Jack, Ten, Nine, Eight, Seven, Six, Five, Four, Three, Two };
I have anathor class file named "Class1.cs" which is outside the Codes folder. The source of the class is as follows:
public class Class1
{
Card card = new Card();
}
In this class file i created an instance of "Card" structure successfully as shown in above code. But i cannot access the properties of structure like this(as shown bleow):
card.Suit = CardSuit.Clubs;
Please Help,
Thanks