You are not logged in.
- Topics: Active | Unanswered
Pages:: 1
#1 2015-05-26 05:52:25
Snippet Code:
Question:
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;
}
Option A):
7 6
Option B):
5 6
Option C):
6 5
Option D):
6 7
Correct Answer is Option A):
7 6
Failure is the first step towards seccess.
Offline
2015-05-26 05:52:25
- Advertisement
- Ads By Google
Re: Snippet Code:
\n
Pages:: 1