0

Output of C++ code

Hello, another C++ question about the output of the following code, can someone explain it? https://code.sololearn.com/cDD63zTxAafs/#cpp

26th Sep 2020, 9:58 PM
Edward Finkelstein
Edward Finkelstein - avatar
5 odpowiedzi
+ 3
b is static. It mean that this variable is for any object of this class the same. If you increase b in object x it increase b in object y too. Static variable is for all class, not for each object like other variables.
26th Sep 2020, 10:05 PM
Derlas Forenly
Derlas Forenly - avatar
+ 1
@Martin Taylor Yes, I already found this out from Derlas Forenly's answer, but thank you anyway.
26th Sep 2020, 10:30 PM
Edward Finkelstein
Edward Finkelstein - avatar
0
This makes sense now, thank you Derlas Forenly.
26th Sep 2020, 10:14 PM
Edward Finkelstein
Edward Finkelstein - avatar