Answer Overflow Logo
Change Theme
Search Answer Overflow
GitHub
Add Your Server
Login
Home
Popular
Topics
Gaming
Programming
Pobiega
Posts
Comments
C
C#
•
Created by Trapyy on 3/21/2025 in
#help
✅ When to use each constructor?
but
a
still exists, and can be mutated and used
15 replies
C
C#
•
Created by Trapyy on 3/21/2025 in
#help
✅ When to use each constructor?
A
gets the value from
a
, as we intended
15 replies
C
C#
•
Created by Trapyy on 3/21/2025 in
#help
✅ When to use each constructor?
there you go
15 replies
C
C#
•
Created by Trapyy on 3/21/2025 in
#help
✅ When to use each constructor?
1 sec
15 replies
C
C#
•
Created by [Helium] on 3/21/2025 in
#help
Any good guides/videos to learn Abstract Classes?
but for games, composition tends to give better results
31 replies
C
C#
•
Created by [Helium] on 3/21/2025 in
#help
Any good guides/videos to learn Abstract Classes?
a dog
is
an animal
31 replies
C
C#
•
Created by [Helium] on 3/21/2025 in
#help
Any good guides/videos to learn Abstract Classes?
inheritance solves some problems nicely, like the "is a" question
31 replies
C
C#
•
Created by [Helium] on 3/21/2025 in
#help
Any good guides/videos to learn Abstract Classes?
this is where "composition over inheritance" comes from
31 replies
C
C#
•
Created by [Helium] on 3/21/2025 in
#help
Any good guides/videos to learn Abstract Classes?
what if the sword also acts as a fluid container? (crazy I know but bear with me)
31 replies
C
C#
•
Created by [Helium] on 3/21/2025 in
#help
Any good guides/videos to learn Abstract Classes?
do we base it on IceSword, or FireSword? or just on Sword itself?
31 replies
C
C#
•
Created by [Helium] on 3/21/2025 in
#help
Any good guides/videos to learn Abstract Classes?
but then you want to make another sword that is both ice AND fire... oops, what do we do now?
31 replies
C
C#
•
Created by [Helium] on 3/21/2025 in
#help
Any good guides/videos to learn Abstract Classes?
so you make
Sword > IceSword
31 replies
C
C#
•
Created by [Helium] on 3/21/2025 in
#help
Any good guides/videos to learn Abstract Classes?
and then you want to make a sword that deals ice damage, instead of slashing
31 replies
C
C#
•
Created by [Helium] on 3/21/2025 in
#help
Any good guides/videos to learn Abstract Classes?
Consider if you make a hierarchy like...
Item > EquippableItem > Weapon > Sword
31 replies
C
C#
•
Created by [Helium] on 3/21/2025 in
#help
Any good guides/videos to learn Abstract Classes?
but inheritance tends to break down poorly in situation like that, if you ask me
31 replies
C
C#
•
Created by [Helium] on 3/21/2025 in
#help
Any good guides/videos to learn Abstract Classes?
I could kinda see how an abstract class could be used with an item system in general, like you could have a
BaseItem
class or something
31 replies
C
C#
•
Created by Trapyy on 3/21/2025 in
#help
✅ When to use each constructor?
and if they are captured and exposed as private fields, they are sadly not readonly, which is why I personally don't use primary ctors for non-records
15 replies
C
C#
•
Created by Trapyy on 3/21/2025 in
#help
✅ When to use each constructor?
The minor difference is that the top one (primary constructor) lets you use the
item
and
quantity
variables again, in which case they would get captured
15 replies
C
C#
•
Created by Trapyy on 3/21/2025 in
#help
✅ When to use each constructor?
These are functionally the same, its a matter of preference.
15 replies
C
C#
•
Created by [Helium] on 3/21/2025 in
#help
Any good guides/videos to learn Abstract Classes?
well then you actually understand abstract classes! its just an extreme version of normal inheritance, where you
must
inherit it to use it
31 replies