   Another template question
  Hi,I am trying to do some template programming, but the code gives error at the line "s.push(f); ." The error is stack.cpp:39: no matching function for call to Stack:ush(const float&)  I am unable to see as to what I am doing wrong which is not allowing it to compile.   #include <iostream>#include <cstdio>template <class T>class Stack {    public :   Stack(int size);   void Push(const T &t);   void Pop(T &t);  private :   T *stackPtr;   int top;};template <class T>Stack<T>::Stack(int size){    stackPtr = new T[size];    top = -1;}template <class T>    void Stack<T>::Push(const T &t){    stackPtr[++top] = t;}template <class T>void Stack<T>::Pop(T &t){    t = stackPtr[top--];}int main(){    Stack<float> s(2);    const float f = 0.5f;    s.push(f);   return 0;}  Thank you   
  Did you try capitalizing push? i.e.: s.Push(f)You have the function declared capitalized in the class declaration. ;  I have this feeling, that this could work  Im not sitting at a compiler right now so I cannot try, but I think I suffered from this very same problem.To fix it you have to either put extern if front of the push declaration or put the code of the push with the declaration.Example: template <class T>class Stack {    public :  Stack(int size);  void Push(const T &t)    {  stackPtr[++top] = t;    }};;  Listen to SiCrane. ;quote:Original post by SiCrane  Did you try capitalizing push? i.e.: s.Push(f)You have the function declared capitalized in the class declaration.   Silly me, that works. Thank you. 