19. Design a class which contain static data member and member function show() which displays number of times display operation is performed irrespective of the object responsible for display using static data member.


#include<iostream.h>
#include<conio.h>
class stat
{
static int n;
public:
static void show()
{
cout<<“\nNumber of time call show: “<<n;
n++;
}
};
int stat::n;
void main()
{
stat s1,s2,s3;
clrscr();
s1.show();
s2.show();
s3.show();
getch();
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s