Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,398 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,108 people online right now. Registration is fast and FREE... Join Now!




classes with static member function

 
Reply to this topicStart new topic

classes with static member function, i have exam tomo

brainy_creature
26 Oct, 2006 - 04:03 AM
Post #1

D.I.C Head
**

Joined: 7 Aug, 2006
Posts: 174



Thanked: 1 times
My Contributions
i have kinda understood this program but i don't understand the part in the main()
please explain sequentially how the program proceeds!
CODE

#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 Oct, 2006 - 04:06 AM
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/5/08 03:02AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month