sorry i thought u knew the function inc() in circular queues,It is the function to increment the index by one in a circular array
void inc(int i){
if (i==maxsize-1)
i=0;
else
i=i+1;
}
why do we have it as a private method?
As I said, there are many ways to implement circular queues, not all of which have that function. It could be private for any number of reasons. You have not provided enough information for anyone to answer your question.
Also, the function (as you have written it, possibly with typos) does nothing.
The most likely reason for it being private is that it is a helper function.
A helper function is an enabler of your class's public interface. You have no business knowing what it does, just that it helps the class interface work. It's like the spark plug in your car's engine (if you have a car). You don't need to know how the engine is working, how it's distributing its fluids; all you need to know is whether it's turned on or off. Those formulas that tell the engine how to do its thing are helper functions in the private section.
1 2 3 4 5 6 7 8
class Car
{
public:
bool isOn( /*parameters */ ); // all you need to know is this
private:
size_t sparkTimer; // unless you're a mechanic, you don't need or care about this
// etc.
}