i have a template stack class that holds structure objects .. The trouble comes when i want to play around with the top element of the stack
I use this code
Code:
T& top(){
return stck[tos];
}
and in main or another function
Code:
stack <entry*> ob;
entry *temp = new entry;
temp->s = 12;
temp->t = "adfadsf";
ob.push(temp);
entry = ob.top(); //this doesnt work : /
this works for the pop() function but not for top !!!