What are static class member ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What are static class member ?

13th May 2018, 7:57 AM
Yashraj Yadav
Yashraj Yadav - avatar
2 Answers
+ 1
Usually, you use static on things that all instances of the class share. Say you make a class for circles to be drawn on the screen. You might want a list that contains all of them and you'd make it static so there was only one list. You could also make a static method that used the list to request each instance draw itself.
14th May 2018, 1:31 AM
John Wells
John Wells - avatar
0
all object share (one) static class member, becaue in some cases we need all objects of class have the same value of the varable. for example. like (tax) if we have class include member or varable named(tax) so all objects of this class have the same tax. and the other benift that if we need to change the (tax) we just change the value of static member so all objects can see this change. hopefully it is clear. thanks
20th May 2018, 12:06 PM
whbe
whbe - avatar