olleeee
creating objects in a different class
from my teacher: class Hogwarts
Here I miss your SortingHat. It should be in this class. Nor should you have a public list of House here. You already have them in your respective student residences. COMPLETE
class Wizard
Neat. Here you have created classy methods.
The interface
Here you will retrieve the mascots from your objects. Do not write them COMPLETE
lblHufflepuffMascot.Content = "Badger";
You create new instances (objects) of your houses in the interface. It's ok because you don't do this at Hogwarts. But I think it's stupid and when you change anyway. Do this too. Also, they are a bit crazy as you make them now in the interface. You must create House and not, for example, Hufflepuff. COMPLETE
Since you will have the houses in Hogwarts, this must also be changed:
hogwarts.Houses.Add(griffindor);
You must change the password in the same way as in my test code. That is, completely without if statements
if (gryffindor.SetPassword <-- remove and all that look alike
Replace with house.SetPassword <-- general method for all student houses. When you do so, you will also reduce the number of lines of code by perhaps 50!
5 replies