The way I understand it, having a member variable declared as static in a no-static class causes that member variable to be unique no-matter the number of instances of that class.
Now, what happen to a static method declared in non-static class? And (Most importantly), what the point of declaring a static method in a non-static class?
Thanks for helping
Class method which works only with its parameters, doesn’t call any instance methods and doesn’t work with any instance members, may be declared as static. Actually, it should be declared as static, for better performance, since static method doesn’t require “this” pointer.
Consider small function which belongs to class, makes some calculations with its parameters and returns calculated value. This function should be static.