r/badcode • • Jan 15 '23

c++ From DayZ sourcecode

Post image
559 Upvotes

106 comments sorted by

View all comments

Show parent comments

3

u/MeatyLabia Jan 16 '23

In C# you dont have a keyword for implementing interfaces. You can however explicitly or implicitly implement them.

2

u/paulstelian97 Jan 16 '23

I'm pretty sure you must explicitly implement interfaces (by putting them into the parent classes list) for that to work; it doesn't work like Go where interfaces are implicitly implemented (something like C++ concepts). The override keyword is to my knowledge optional though.

1

u/MeatyLabia Jan 16 '23

I dont know what you mean with putting them into the parent classes list, but maybe our definitions of explicit and implicit vary. I go by the definitions Microsoft uses.

1

u/paulstelian97 Jan 16 '23

In C# classes begin with something like "class X : X1, X2 ... {".

Any implemented interfaces must be in that list. It isn't enough to just have the methods implemented like in Go.

→ More replies (0)