This is a small program so i have pasted all of it..The problem it is stating is that the count is undeclared in both the constructor & destructor...but i have already globaly deaclred it...need help..thanks..with an explanation..
#include<iostream>
using namespace std;
int count=0;
class alpha
{
public:
alpha()
{
count++;
cout << "no of objects created" << count;
}
~alpha()
{
cout << "no of objects destoryed" << count;
count--;
}
};
main()
{
cout << "Enter main";
alpha a1,a2,a3,a4;
{
cout << "Enter block1";
alpha a5;
}
{
cout << "Enter block2";
alpha a6;
}
cout<< "Re-enter main";
system ("pause");
}