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();
}

Comments

Popular posts from this blog

Write a program to add two number using inline function in C++?

Traversing of elements program with algorithm and Flowchart