//default constructor public Hats() { //assinging method to delegate. Tryonhat methods assined to delegate //my object of the delegate TryHat myHat = TryOnHat; TryALargerHat("fadora", 7, myHat); }
public void TryALargerHat(string type, int oldSize, TryHat another) { another("I triedon a " + type + " hat at size " + (oldSize + 1).ToString()); }
public Hats() { TryHat myHat = TryOnHat; TryALargerHat("Fedora", 7, myHat); }
public Hats() { TryHat myHat = TryOnHat; TryALargeHat("fadora", 7, myHat); }
public void TryALargerHat(string type, int oldSize, TryHat another) //this is a pointer to the TryHat method { another("I tried on a " + type + " hat at size " + (oldSize + 1).ToString()); }
public Hats() //constructor takes no parameters { TryHat myHat = TryOnHat; //we are assigning method to the delegate TryALargerHat("Fadora", 7, myHat); //method }
//tryon=delegate public void TryALargerHat(string type, int oldSize, TryHat another) //constructor no parameters { another("I tried on a " + type + " hat at size " + (oldSize + 1).ToString()); }