+ 1

How to come output 3 ?

#include <iostream> using namespace std; class A{ public: static int a; A() {a++;} }; int A::a=1; void f(void){ A a; throw string("?"); } int main() { A a; try{f();} catch(string &s){} cout<<A::a; return 0; }

1st Oct 2017, 6:10 PM
Anuj kumar
Anuj kumar - avatar
2 Respuestas
+ 1
Gordie thanks :)
1st Oct 2017, 7:13 PM
Anuj kumar
Anuj kumar - avatar