/
Don't use static methods on classes

Don't use static methods on classes

Yes one can do this.

class BASthread{ public: static long getThreadId(); // Get ID of current thread };

But in the interests of making code which is accessible to the widest audience possible with as little cognitive load it’s better just to write the code as function like this:

long BASthreadId(); // Get ID of current thread

Then everyone can easily understand that this is just a function one can call from anywhere. They don’t need to be C++ experts or understand the three meanings of static.

This is better.

See reduce complexity by limiting use of features.

See don’t use => for Javascript anonymous functions.

Related content

Don't use obfuscated Javascript libraries in development
Don't use obfuscated Javascript libraries in development
Read with this
What are classes and methods in C++?
What are classes and methods in C++?
More like this
Don't use => syntax for anonymous functions
Don't use => syntax for anonymous functions
Read with this
Static keyword - it's multiple meanings in C++
Static keyword - it's multiple meanings in C++
More like this
Do not store application data in the DOM
Do not store application data in the DOM
Read with this
Mutex
More like this