C
C#12mo ago
olleeee

creating objects in a different class

Hi, i have just gotten some feedback from handing in a project, my professors says that i have made some errors. I have corrected them but was wondering if anybody could just look through it and see if the comments in agreeing with the changes? https://discord.com/channels/143867839282020352/1181094353683365958/1181094353683365958 here is the code and will post the feedback underneath
4 Replies
MODiX
MODiX12mo ago
olleeee
Hi, im currently building a project based on harry potter and have a lot of different functions and methods within that. I handed my assignment in but got a little bit a feedback back. I was just wondering if anybody could just read through the updated code, and the feedback to see if it all looks alright? https://paste.mod.gg/llfbdoudrfqr/4
Embed Type
Link
React with ❌ to remove this embed.
olleeee
olleeeeOP12mo ago
BlazeBin - rkruocmlhtwn
A tool for sharing your source code with the world!
olleeee
olleeeeOP12mo ago
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!
Bailey
Bailey12mo ago
You should look how to use Private and public. just an example if the object is created. I can get the password like this : var savedPassword = House.Password;
Want results from more Discord servers?
Add your server