0 Replies - 1006 Views - Last Post: 26 October 2006 - 05:03 AM Rate Topic: -----

#1 brainy_creature  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 177
  • Joined: 07-August 06

classes with static member function

Post icon  Posted 26 October 2006 - 05:03 AM

i have kinda understood this program but i don't understand the part in the main()
please explain sequentially how the program proceeds!
#include<iostream.h>
#include<conio.h>
class test
{
int code;
static int count;
public:
void setcode(void)
{
code=++count;
}
void showcode(
{
cout<<"object member="<<code<<endl;
}
static void showcount(void)
{
cout<<"count="<<count<<endl;
}
};
int test::count;		  
int main()			 
{
test t1,t2;	 
t1.setcode();  /* starting from here*/

t2.setcode();
test::showcount;
test t3;
t3.setcode();
test::showcount();
t1.showcode();
t2.showcode(); /*till here, plz explain */
return(0);
getch();
}


This post has been edited by brainy_creature: 26 October 2006 - 05:06 AM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1