public Form1() { InitializeComponent(); // creating punter object using factory class joe = Factory.GetApunter("Joe", this.rbJoe, 50, this.tbJoe); al = Factory.GetApunter("Al", this.rbAl, 50, this.tbAl); bob = Factory.GetApunter("Bob", this.rbBob, 50, this.tbBob); currentBets = new Bet[3]; }
// to create punter objects based on name bassed public static Punter GetApunter(String name, RadioButton rb, int cash, TextBox label) { Punter p = null; if (name.ToLower() == "joe") { p = new Joe("Joe", rb, cash, label); } else if (name.ToLower() == "al") { p = new Al("Al", rb, cash, label); } else if (name.ToLower() == "bob") { p = new Bob("Bob", rb, cash, label); } return(p); }