#include<iostream.h>
#include<conio.h>
class test
{
int code;
static int count;
public:
void setcode()
{
code=++count;
}
void showcode()
{
cout<<"\n Code:-"<<code<<endl;
}
static void showcount()
{
cout<<"\n Count:-"<<count<<endl;
}
};
int test :: count;
void main()
{
clrscr();
test t1,t2;
test::showcount();
t1.setcode();
t1.showcode();
test::showcount();
t2.setcode();
t2.showcode();
test::showcount();
t1.showcode();
t2.showcode();
getch();
};
No comments:
Post a Comment