Вопрос

For flexibility, I've seen some APIs w/ classes that provide identically named class and instance methods.

Are there any reasons as to why this might be a bad idea?

Это было полезно?

Решение

That is at the heart of object oriented programming. It is called polymorphism. It is a good practice. Denying that would be denying object oriented programming.

It saves the brain power of whomever reads or writes the code. You would have to remember less methods, and you don't have to switch between them.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top