Still dont understand how to make this stack templated

This is my stack

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
using namespace std;
#define size 100
class Stack {
public: 
	Stack() : top(-1){}
	char pop();
	void push(char ch);
	void print ();
	char input[size];
	int top;
	
};
void Stack::push(char ch){
	if (top >= size){
		cout <<"Stack is full " <<endl;
		cin.get();
		return;
	}
	top++;
	input[top] = ch;
}
char Stack::pop(){
	if (top <0) {
	return 0;
	}
	if (top > -1){
		input[top]=NULL;
	top--;
	}
}
void Stack::print () {
8	if(top > -1){
	cout << input[top];
     }
}


I have tried to replace the instances of char with T, but that gives me errors. All I need to do is make this same stack class be able to use all types of data. Anyone have any suggestions?
This should be fairly straightforward to turn into a template class -( I say' fairly straightforward' but there are a couple of tricky points)

Show us what you did to turn it into a template class so far.
Topic archived. No new replies allowed.