The Daily WTF
Follow
CodeSOD: Disable This
Overriding functions in object-oriented programming allows for extending or modifying function implementations in derived classes. However, a specific code snippet demonstrates a useless override of the "isEnabled" function. The override returns true if the superclass's "isEnabled" function returns true, making the override redundant. Calling the superclass function directly would achieve the same result without the need for an override. The override is not a remnant of previously useful code and has always been useless. This example highlights the potential pitfalls of careless overriding and the importance of understanding the purpose and impact of code changes.