#include<iostream> #include<conio.h> using namespace std;
class myClass { private: static int count; public: myClass() { count++;} int getcount() {return count;} }; int myClass::count=0;
void main() { myClass obj1; cout<<"Value of static member after making first object is:"; cout<<obj1.getcount()<<"\n"; myClass obj2; cout<<"\nValue of static member after making second object is:"; cout<<obj2.getcount()<<"\n"; myClass obj3; cout<<"\nValue of static member after making third object is:"; cout<<obj3.getcount()<<"\n"; }