Write a program to show the concept of static member function in C++
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class account
{
static int count;
public:
static void display()
{
count++;
cout<<"the value of count="<<count<<endl;
}
};
int account::count=50;
void main()
{
account obj1, obj2;
account::display();
account obj3;
account::display();
}
#include<conio.h>
#include<iomanip.h>
class account
{
static int count;
public:
static void display()
{
count++;
cout<<"the value of count="<<count<<endl;
}
};
int account::count=50;
void main()
{
account obj1, obj2;
account::display();
account obj3;
account::display();
}
Comments
Post a Comment