With respect to the following code segment, what should be the n value in different classes, e.g., what is a.n, b[2].n, and c->n
How to analyze them?
#include <iostream>
using namespace std;
class CDummy
{
public:
static int n;
CDummy(){ n++ ;};
~CDummy(){ n--; };
};
int CDummy::n = 0;
int main()
{
CDummy a;
CDummy b[5];
CDummy*c = new CDummy;
system("PAUSE");
return 0;
}