# include < iostream.h >
class counter
{
private: unsigned int count;
public : counter() { count = 0; }
counter(int x) { count = x; }
int get_count() {return count;}
counter operator ++ ()
{
count ++;
counter temp;
 temp.count = count; 
return temp;
}
    };
    void main()
   {
    counter c1 ,c2;
    cout << "\n c1 = " << c1 .get_count() << "\n c2 =" << c2.get_count();
    c1++; c2=c1++;
    cout << "\n cl =" < c1.get_count() <<"\n c2 =" << c2++.get_count();
   }
Click here to go back.  

Our aim is to provide information to the knowledge seekers. 


comments powered by Disqus




Footer1