Sunday 14 April 2013

STATIC MEMBER FUNCTION AND STATIC VARIBLE IN C++ PROGRAMMING LANGUAGE

/*
  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  :::: THIS PROGRAMM EVALUTE THE CONCEPT OF STATIC MEMBER FUNCTION   ::::
  :::: AND STATIC VARIBLE IN C++ PROGRAMMING LANGUAGE                ::::
  :::: DEVLOPED BY DX PANCHAL AT GROW MORE M.C.A. LAB                ::::
  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

*/
// HEADER FILE DECLARATION
#include<iostream.h>
#include<conio.h>
#include<dos.h>

//CLASS TEST DECLARATION
class test
{

  int code;
  static int count;
  public:
     void setcode(int m)
     {
       code=m;
       count++;
       cout<<"\n\n\t\tVALUE OF CODE::>"<<code;
     };
     static void check()
    {

       cout<<"\n\n\t\tVALUE OF COUNT::>"<<count;

     };

};
int test::count;
// END OF CLASS TEST

// MAIN FUNCTION SECTION

void main()
{
  clrscr();
  test t1,t2;
  t1.setcode(1);
  t1.setcode(1);
  t2.setcode(1);
  t2.setcode(1);
  test::check();



 getch();

}

No comments:

Post a Comment

How to change Background color by selecting color from Listview

activitymain.xml file::> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     xm...