+ 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
1 Réponse
+ 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