Hey all,
I'm having problems with trying to understand how this will work. I'm trying to make my own stack implementation (yes, homework assignment) but I'm not sure how my two constructors will work. One constructor takes an Int and the other a Char. When I'm push()'ing something onto the stack, what type of paramenter should I use? Int and type it to a char? or vice versa?
public MyStack(int size) {
private int stack = new int [size];
} // End First Constructor
public MyStack(int size, char c) {
private char stack = new char [size];
} // End Second Constructor
Here's my two constructs, should I make two methods called push and pop() , one for each type (int and char) ?? Any help would be greatly appreciated!
Thanks in advance
Andrew
I'm having problems with trying to understand how this will work. I'm trying to make my own stack implementation (yes, homework assignment) but I'm not sure how my two constructors will work. One constructor takes an Int and the other a Char. When I'm push()'ing something onto the stack, what type of paramenter should I use? Int and type it to a char? or vice versa?
public MyStack(int size) {
private int stack = new int [size];
} // End First Constructor
public MyStack(int size, char c) {
private char stack = new char [size];
} // End Second Constructor
Here's my two constructs, should I make two methods called push and pop() , one for each type (int and char) ?? Any help would be greatly appreciated!
Thanks in advance
Andrew