If each member function is only contained once per class (to be shared by all instances) what exactly is the purpose of declaring a member function static? Is it like a function being declared const, in that it modifies a particular type of data (in this case, static data members)?
Share
Normal member functions require a class instance to run. Static methods can be called directly without first creating an instance of the class.
Normal method:
Static method:
So normal methods are perfect for functions that work with the class data. If a method doesn’t need to work with the class data, then it would be a candidate for possibly being made static.