I need to implement a circular queue in the following way in c ++, but the following code is Java.
class ColaCircular{
private int frente; //frente cola
int maximo; //capacidad cola
int n; //número elementos
int []vcola; //vector Cola
public ColaCircular(int tamano){
maximo=tamano; //define capacidad
vcola=new int [maximo]; //crea espacio en la cola
frente=0; //inicio variable frente
n=0; //inicio variable número elementos
}
}
Try using this:
struct Cola {
short frente;
const short Max_Cola;
short Cant_Clientes;
int UnaCola[Max_Cola];
Cola() : Max_Cola(10) {}
};
But Code :: Blocks 16.01 does not allow it:
error: invalid use of non-static data member 'Cola::Max_Cola'|
Is there any way to do this by declaring the constant within the structure?