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