Why?

Blogging Reading Chatting Meeting. The other aspect of life.

Thursday, June 26, 2008

WAP TO SHOW THE WORKING OF STATIC MEMBERS

#include

#include

class test

{private:

int code;

static int count;

public:

void setcode()

{code=++count;}

void showcode()

{cout<<"code--"<

static void showcount()

{cout<<"count--"<

};

int test::count;

void main()

{clrscr();

test t1,t2;

test::showcount();

t1.setcode();

t1.showcode();

test::showcount();

t2.setcode();

t2.showcode();

test::showcount();

getch();

}

No comments: