Why I declare everything static | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Why I declare everything static

16th Apr 2017, 3:24 AM
RAGHUL ARUMUGAM
RAGHUL ARUMUGAM - avatar
5 Answers
+ 8
static means that "that member" belongs to a class rather than to an object. To declare everything static means you will not need to create objects
16th Apr 2017, 5:23 AM
Meharban Singh
Meharban Singh - avatar
+ 4
not sure.... you tell me....
16th Apr 2017, 3:52 AM
Edward
+ 4
Good question, why do you do that?
16th Apr 2017, 6:26 AM
Tamás Barta
Tamás Barta - avatar
+ 3
By using static methods only you do procedural programming in an oop language.
16th Apr 2017, 6:47 AM
Tamás Barta
Tamás Barta - avatar
0
main advantage: easier to test (no need to setup complex unit test Environment) drawback: no real oop, more like procedural languages like C or FORTRAN
16th Apr 2017, 9:00 AM
Volker Milbrandt
Volker Milbrandt - avatar