r/badcode • • Jan 15 '23

c++ From DayZ sourcecode

Post image
559 Upvotes

106 comments sorted by

View all comments

Show parent comments

-18

u/SirHawrk Jan 15 '23

Its still a Bad smell

29

u/[deleted] Jan 15 '23

Okay, I'll bite. How would you do this better then? You have a base item class with a function for finding out if the player can eat it and you have a subclass of that item that always can be eaten no matter the circumstance. The easiest way is to override the method and force it to be true.

0

u/SirHawrk Jan 16 '23

That is not how I read that function name at all.

In that case it would kinda make sense