Tuesday, 2 July 2013

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

No comments:

Post a Comment