+ 2
Why do we need static class?
When i can just make all the functions & vars static? I understand we can have only one instance but what its helping with?
3 Answers
+ 3
The main reason it that is alerts the compiler when you do something non-static in this class. That you did not intended to do that.
Static function are linked to the class not to the instances of the class.
They usually help with simple tasks, like Count, Getinterest.
Sometimes you have a whole class of them.
Try make a calculator with al static Math - class.
https://www.infoworld.com/article/3045882/application-development/its-all-static-static-classes-and-members-in-c.html
+ 1
up
+ 1
@sneeze Good to know. Thx!