0

What is the advantage of static function and where it will useful???

the static key word infront of function is a called static function but what is it's purpose

12th Mar 2017, 3:02 PM
Swamy Kanuri
Swamy Kanuri - avatar
1 Odpowiedź
+ 3
For example to create functionality which doesn't need a state. For example a min(a, b) function which returns maximum of a or b should be static to be able to call without creating an instance of a class. Utility methods are usually static.
12th Mar 2017, 3:42 PM
Tamás Barta
Tamás Barta - avatar