When to use static methods?

Asked

Viewed 43 times

1

I am working on a project and as a base I am using another for reference. However, in this other project almost all methods are declared as static.

This is good practice?

What are the advantages or disadvantages I have in declaring a method as Static?

  • 3

    Stackoverflow’s own double question. http://answall.com/questions/12651/quando-devemos-declarar-um-m%C3%A9todo-como-est%C3%A1tico

  • 1

    Thanks for the references. But after reading all this I still get in doubt. Because according to them n is bad practice. And it has considerable gains in some cases. But I’ve never seen a whole system like this. So to me the first view seems n to be correct to create an entire system with Static methods!

  • 1

    If you still have a specific question, ask the question about that question in a specific way (some very specific point not answered). What was asked is already well answered in these other questions. You can also put a reward on one of them asking for more details.

  • More: http://answall.com/q/54012/101, http://answall.com/q/103796/101, http://answall.com/q/123974/101,

  • Thanks @bigown! I’m much more enlightened now and see q n will have problems using static methods. :)

  • Depends on how to use, yes, in other cases, no

  • Yes. I still intend to study a little further by sinking object orientation to clarify myself further and better apply the concepts.

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.