mercredi 4 mars 2015

Providing the size (const) of the member array as the constructor argument RELOADED


I have gone through some of the threads on the same topic but they are really advanced like set and all. For someone just finding his footsteps in C++, what would be the best way to deal with this?


The following code gives me error:



class AStack {
public:
Astack(int size) : Max_Size(size) {
}
void push(int);
int pop();
int top();
bool isEmpty();
void Flush();

private:
const static int max_Size;
int a[max_Size];
int index = -1; // Index of the top most element
};



Aucun commentaire:

Enregistrer un commentaire