C
C#7mo ago
Ewan

✅ addpizza line 41 help!

on line 41 in the addpizza tab ive written _Toppings topping = selectToppingMenu.Topping(); but the .Topping() isnt working, why? help please!
8 Replies
Ewan
EwanOP7mo ago
BlazeBin - udnlcbzmleug
A tool for sharing your source code with the world!
Ewan
EwanOP7mo ago
it should be getting the .topping() from the editpizza tab but it isnt ;-; its saying non invocable member EditPizzaToppings.Topping cannot be used like a method
SpReeD
SpReeD7mo ago
Because the Property Topping is null
Ewan
EwanOP7mo ago
what can i do to save it?
SpReeD
SpReeD7mo ago
EditPizzaToppings selectToppingMenu = new EditPizzaToppings();
selectToppingMenu.Select();
_Toppings topping = selectToppingMenu.Topping();
EditPizzaToppings selectToppingMenu = new EditPizzaToppings();
selectToppingMenu.Select();
_Toppings topping = selectToppingMenu.Topping();
You're creating a new instance, the overloaded constructor sets the recipe parameter to null. Your Select method tries to get something, which probably result in null as well or default, I think it's an enum? Because _recipe is null from the beginning.
Ewan
EwanOP7mo ago
hmm ok ill give it a look thanks
SpReeD
SpReeD7mo ago
It's honestly a bit confusing for me; while _Toppings is an unflaggable enum, how do you wanna have more than one of it in the property Toppings? Either make it a flaggable enum or a List property. Also why does the Recipe include both, burger and pizza properties? I would suggest beginning with an abstract class of Food and having models for each type of food with their respective properties, like ingredients.
Ewan
EwanOP7mo ago
ill try my best ;-;
Want results from more Discord servers?
Add your server