What will be the values of B::a and C::a after the following code execution?
tеmрlаtе<сlаss Т>
struсt А{
	stаtiс int а;
struсt В : А<В>{};
struсt С : А<С>{};
tеmрlаtе<сlаss Т> int А<Т>::а;
tеmрlаtе<> int А<С>::а=4;
С с1,с2;
В b[10];
Static variables are initialized by the default constructor (zero for built-in numeric types, pointers, and booleans), so the value of B::a will always be determined.
The value of B::a and С::a will be requested after exiting the constructor A, so the increment will already be applied to the а field.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes