+ 1

Class A {

public: static int cnt ; A(int a) {} ~A() {++cnt;} } ; int A::cnt =0; int main() { Vector<A>v(5,1); cout<^A::cnt<<endl; return 0; } Can anyone tell me what actually is happen in this code. I don't understand it

30th Apr 2018, 6:07 AM
Karan Rawat
1 Answer
+ 5
This is the correct code: class A { public: static int cnt; A(int a){} ~A() {++cnt;} }; I can’t really understand the code in the main
30th Apr 2018, 8:04 AM
Chalza
Chalza - avatar