What is the output of the following code snippet?
class test {
public:
static int n;
test () { n++; };
~test () { n--; };
};
int test::n=0;
int main () {
test a;
test b[5];
test * c = new test;
cout << a.n << endl;
delete c;
cout << test::n << endl;
return 0;
}
Options
- 7 6
- 6 7
- 5 6
- 6 5
CORRECT ANSWER : 7 6
Write your comments