MuruganAD.com
Murugan Andezuthu Dharmaratnam

  |  HOME   |  BLOG   |  ARTICLES   |  8086   |  C++   |  VC++   |  ASP .NET   |  VB .NET   |  JAVA SCRIPT   |  MS SQL   |  MY   |  VIDEOS   |  DOWNLOADS   |  CONTACT ME   |  



Static Function

Home    C++    Static Function


/* Example For Static Function And Static Variable */
/* Simple Code for showing Usage Of Static Variable and Function */

#include<iostream.h>
#include<conio.h>
class stat
{
private:
static int a;
public:
static void inc(void);


};
int stat :: a; //redeclaration of static variaable outside the class
void stat::inc(void)
{
a++;
cout<<"nObject "<<a<<" is createdn";
cout<<"value="<<a<<endl;
}

void main()
{
clrscr();

stat obj1;
stat::inc();
stat obj2;
stat::inc();
getch();
}




  |  HOME   |  BLOG   |  ARTICLES   |  8086   |  C++   |  VC++   |  ASP .NET   |  VB .NET   |  JAVA SCRIPT   |  MS SQL   |  MY   |  VIDEOS   |  DOWNLOADS   |  CONTACT ME   |  

Copyright 2009 @ Murugan Andezuthu Dharmaratnam