+ 7

Explain why result is "ssl" ? Why two 's', and not one 's'?

#include <iostream> using namespace std; struct S { S() {print('s');} void print(char c) { cout<<c; } }A; int main(){ S a; a.print('l'); return 0; }

20th Apr 2019, 6:43 PM
UraL
4 odpowiedzi
+ 2
UraL you just answered your one question.
20th Apr 2019, 7:23 PM
Aaron Stone
Aaron Stone - avatar
+ 8
I got it. Because struct S {...} A; A is reason
20th Apr 2019, 6:46 PM
UraL
+ 6
It was insight:-)
20th Apr 2019, 9:35 PM
UraL
+ 3
This question has been asked before https://www.sololearn.com/Discuss/1759662/?ref=app
20th Apr 2019, 7:37 PM
sneeze
sneeze - avatar