#include<iostream.h> #include<conio.h> /*************************************************************************///------------------------------ count --------------------------------///*************************************************************************/class count { private: int count; public: count(intvalue) { count=value; } void inc_count() { count ++; } int get_count() { return count; } }; main( ) { clrscr(); count c1(2); count c2(2); cout<<"c1 = "<<c1.get_count()<<endl; cout<<"c2 = "<<c2.get_count()<<endl; c1.inc_count(); c2.inc_count(); c2.inc_count(); cout<<"c1 = "<<c1.get_count()<<endl; cout<<"c2 = "<<c2.get_count()<<endl; getch(); return 0; }
No comments:
Post a Comment