CiNN CiNN - 1 year ago 88
C++ Question

Is using too much static bad or good?

I like to use static functions in C++ as a way to categorize them, like C# does.


Is this good or bad? If the functions are used often I guess it doesn't matter, but if not do they put pressure on memory?

What about
static const

Answer Source

but is it good or bad

The first adjective that comes to mind is "unnecessary". C++ has free functions and namespaces, so why would you need to make them static functions in a class?

The use of static methods in uninstantiable classes in C# and Java is a workaround because those languages don't have free functions (that is, functions that reside directly in the namespace, rather than as part of a class). C++ doesn't have that flaw. Just use a namespace.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download