Class Counter
{
public Int counter;
public Int limit;
public void increment()
{
If( counter<limit)
{
counter++;
}
}
public void decrement()
{
if (counter>limit)
{
counter--;
}
}
public getvalue()
{
cout<<"Counter Value is:"<<counter;
}
}
Explanation:
Class Counter
{
public Int counter;
public Int limit;
public void increment()
{
If( counter<limit)
{
counter++;
}
}
public void decrement()
{
if (counter>limit)
{
counter--;
}
}
public getvalue()
{
cout<<"Counter Value is:"<<counter;
}
}