138 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
okay I will
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
okay
brb
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
yeah that part confused me a lot
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
i get putting delegate in the param
tebeco#0205
what does your code look like
Quoted by
<@!689473681302224947> from #I don't understand what this is asking for at all (sry for bad title) (click here)
React with ❌ to remove this embed.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
lol
okay i am
:]
so I think I get it more now
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
lol
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
oh yeah
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
so just a
Func<int> func
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
no and I'm reading sorry. so the int is the paramater and the bool is what it returns?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
it will only be for the better
Func<int, bool>
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
but that's so much more confusing to me lol
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
tebeco#0205
Quoted by
<@!689473681302224947> from #I don't understand what this is asking for at all (sry for bad title) (click here)
React with ❌ to remove this embed.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
okay
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
lol okay
i didn't know ctor came first
i think I need to read the delegate information again
brb
I'm just so confused man I'm sorry
idk why but none of this makes sense to me.
the chapter isntruction used a user made delegate, I have no idea what to do with this
func
thing
and brb again, i'm sick 😭
Objectives:
• Create a Sieve class with a public bool IsGood(int number) method. This class needs a constructor with a delegate parameter that can be invoked later within the IsGood method. Hint: You can make your own delegate type or use Func<int, bool>.
• Define methods with an int parameter and a bool return type for the following: (1) returns true for even numbers, (2) returns true for positive numbers, and (3) returns true for multiples of 10.
• Create a program that asks the user to pick one of those three filters, constructs a new Sieve instance by passing in one of those methods as a parameter, and then ask the user to enter numbers repeatedly, displaying whether the number is good or bad depending on the filter in use.
• Answer this question: Describe how you could have also solved this problem with inheritance and polymorphism. Which solution seems more straightforward to you, and why?
here's the whole of the exercise just so we have the same frame of reference.
i feel like I'm wasting your time my man. Sorry.Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I did what you asked I thought
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
lol okay
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
passing a method like a variable pretty much?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
it's just calling it right?
delegate.Invoke()
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
lol okay
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
right
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
like that?
I only used ctor for assigning properties before, so I didn't know any of this made sense at all
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
tebeco#0205
Quoted by
<@!689473681302224947> from #I don't understand what this is asking for at all (sry for bad title) (click here)
React with ❌ to remove this embed.
lol okay
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
so this is using the delegate now right?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
but how to access?
do i set property to = func?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I am sorry I don't know
variable?
lol
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
LOL
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
i like it
tyvm sorry for being dumb
I am genuinely trying to learn, coding is hard.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
xD
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
i want a job doing this, i have to learn xD
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
yes
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
i honestly don't know bud
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
idk what a field is lol
i'll search real quick
!field
haha was hoping
holy shit okay tyvm
field is nice I'll have to remember that
What I am understanding is like.. adding 2+ 2
It's not the same as stacking 2 block + 2 block, or cutting 2" wood and 2" wood
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
so like I learn what "delegate" is, but not how it is used. Just like I can learn what 2 + 2 is, but not how it's used
I get very frustrated feeling like I'm not learning anything because of this lol
okay so I understand now, I think, tyvm
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ye it's a bout separation right
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
right right
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
i don't understand that lol
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
so you don't even need to write out your delegate functions?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
if i have
func<int, bool>
in ctor I can just slap things in the param?Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
wow nice
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
tebeco#0205
REPL Result: Success
Result: bool
Compile: 613.693ms | Execution: 60.531ms | React with ❌ to remove this embed.
lol
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
from before when I was making delegate
i didn't understand
Func<in, out>
so was taking number in thereUnknown User•3y ago
Message Not Public
Sign In & Join Server To View
you are correct lol
I did
xD
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
lint = fuzz in pocket
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
lol
member?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
okay
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ya that was bad naming. ty for reminding.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
yeah duh ty
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
oh okay
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
i did it lol
honestlyu lambda still confuse me
so i don't use a lot
tebeco#0205
(send code as you edit)
Quoted by
<@!689473681302224947> from #I don't understand what this is asking for at all (sry for bad title) (click here)
React with ❌ to remove this embed.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
yo dude people like you make this place worth being in
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
thank yo uso much.
oh it's not?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
oh okay
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I'll have to read about it xD
you point out other bad things?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I thought about switch expression, I'l lrewrite like that thanks.
If I take new out it throws error "cannot be used like a method"
Oh I get what you're saying.
so you would make a
sieveEven, sievePositive
etc and just reassign them to sieve
in the switchUnknown User•3y ago
Message Not Public
Sign In & Join Server To View
i don't know what state specific means
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
okay
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
okay
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
right
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Thanks. I get confused a lot because I remember "everything public = code smell" but things need to be public so much because I'm bad at writing code xD
so sometimes I don't think about it because idk, I feel like I'm doing things wrong otherwise.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
attributes get ignored
because i'm bad
xD
ty for pointing out though, I will try and remember that
this is what I have now
why did you say return null or something? I have to get a
Sieve
assigned to continue, so what's wrong with just calling itself again to repeat until a valid return
?Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
That was what I was thinking. Thanks.
"cannot implicitly convert bool to type Sieve" when making that change. Gonna look at it for a minute.
Oh duh I fixed it. Thanks a ton for the feedback. :]
✅ This post has been marked as answered!