175. Template

Question.3

A developer separates a template into header and source files:

buffer.h:

template<typename T>
class Buffer {
public:
   void push(T val);  // Declaration
};

buffer.cpp:

template<typename T>
void Buffer<T>::push(T val) { /* impl */ }

main.cpp:

Buffer<int> buf;
buf.push(42);

Will this compile and link?

Need Help? Refer to the Quick Guide below

Select Answer