+ 1
Why is static members called members of class?
4 ответов
+ 10
HonFu are you trying to say that, if 2 instances of a class are trying to manipulate a static member data then they will be referring to the same memory
So changes made by one object will get reflected on another object,
-------------------
Another answer maybe:
Because you don't require to refer a object to call/get a static data, just class name is enough.
+ 3
Because they exist only once for the entire class instead of every instance having a version of its own.
+ 3
HonFu nice code,
I tried to do some thing with your code and boom..!!
Now i have 2 Questions
Q1) in the following code why that "in single quote" is not printing ?
Q2) why its giving a complile time error when i added the 2nd GfG class..??
https://code.sololearn.com/cFO3ue8TtLKn/?ref=app
https://code.sololearn.com/ckN1X69O6dk5/?ref=app
Edit:i tried it newly the same way and worked..
https://code.sololearn.com/cyh9NegqVp8g/?ref=app
+ 2
Aaditya Deshpande, yeah, that's what I said - in longer. 😉
Quick demo:
https://code.sololearn.com/cjCt1i60VvLg/?ref=app