Hi there,
I've written some scripts in VBScript the last years. Since a few month now speeding up with Powershell and getting more interested in .Net. - I bought this book and I think it is quiet good to help me starting with OOP.
I'm now in the chapter which introduces the clsInBetweenRules. Is this already a MVC architecture?
I don't understand the following part:
In the frmMain.cs I have the following line to create an object of the clsInBetweenRules:
Code:
clsInBetweenRules myRules = new clsInBetweenRules();
By clicking the btn_Deal I call a method of this object named "Dealhand"
Code:
myRules.DealHand(cards, ref betResult, ref position);
cards is and empty array defined above as
Code:
string [] cards = new string[3];
betResult and Position are just references to the two variables also declared above in the public class frmMain : Form section. The reference means that the method DealHand will change the variable-values here in this class.
Within the clsInBetweenRules.cs I find the method DealHand as
Code:
public void DealHand(string[] hand, ref int outCome, ref int position)
{
...
SetCards(hand);
...
}
The SetCards(hand) methods is declared as:
Code:
private void SetCards(string[] hand)
{
int temp;
hand[0] = myDeck.getCardPip(lowCardIndex);
hand[1] = myDeck.getCardPip(hiCardIndx);
hand[2] = myDeck.getCardPip(dealtCardIndex);
if (lowCard == hiCard || lowCard < hiCard)
{
hand[0] = myDeck.getCardPip(lowCardIndex);
hand[1] = myDeck.getCardPip(hiCardIndx);
}
else
{
temp = hiCard;
hiCard = lowCard;
lowCard = temp;
temp = hiCardIndx;
hiCardIndx = lowCardIndex;
lowCardIndex = temp;
hand[0] = myDeck.getCardPip(lowCardIndex);
hand[1] = myDeck.getCardPip(hiCardIndx);
}
}
What is the reason for the hand / cards array? The setCards method is void, means returns nothing. The parameters which are passed as values, but nothing further happens?
Hope to read from you soon :)
Many thanks in advance
Juan