#include<iostream.h>
#include<conio.h>
class demo
{
private:
                int i;
public:
                void increment()
                                {
                                i++;
                                }
                void display()
                                {
                                cout<<"\n I = "<<i<<endl;
                                }
};
void main()
{
                static demo d;
                clrscr();
                d.increment();
                d.display();
                getch();
}

146.PNG

Advertisements