I know how to get this done in Java, but I can't figure out how to do it in C++ Here is my questions: I have a class called "stack" and I create different Objects from stack class in my main method. I want to store a variable in the stack class, so all the Object can access the variable. My header file:
Template<class Item>
struct stackLinked{
Item value;
stackLinked* next;
}
Template<class T>
class stack{
public:
static int stored;
.......
.......
private:
.......
}
My main function:
stack<T> temp;
temp.stored=1;
stack<T> numbers;
stack<T> operations;
................
When I stored the value into temp, can numbers and operations have the same variable (same value)?