Top "Static-methods" questions

Methods that neither require an instance of the class nor can they implicitly access the data (or this, self, Me, etc.

When to make a method static?

I'd like to know how people decide whether to define a method as static. I'm aware that a method can …

language-agnostic oop static-methods
Can a Static method access a private method of the same class?

I have this question because of the singleton/named constructor. In both cases, the real constructors are protected or private, …

c++ static-methods
I am confused about using static method in Multithreading java?

something about static: instances of class share static method the similar questions: Java: when to use static methods What does …

java multithreading static static-methods
Python decorator as a staticmethod

I'm trying to write a python class which uses a decorator function that needs information of the instance state. This …

python decorator static-methods
Module function vs staticmethod vs classmethod vs no decorators: Which idiom is more pythonic?

I'm a Java developer who's toyed around with Python on and off. I recently stumbled upon this article which mentions …

python static-methods
Python: Make class iterable

I have inherited a project with many large classes constituent of nothing but class objects (integers, strings, etc). I'd like …

python syntax attributes static-methods loops
How can I run a static initializer method in C# before the Main() method?

Given a static class with an initializer method: public static class Foo { // Class members... internal static init() { // Do some initialization... } } …

c# .net static-methods static-classes static-initialization
Unit-testing a class that calls a static method

I am trying to unit-test a class 'A' which calls a static method of a class 'B'. Class 'B' essentially …

java unit-testing static-methods easymock google-guava-cache
When NOT to use the static keyword in Java?

When is it considered poor practice to use the static keyword in Java on method signatures? If a method performs …

java static static-methods
Why does a static constructor not have any parameters?

Per MSDN: A static constructor does not take access modifiers or have parameters. A static constructor is called automatically to …

c# .net oop static-methods