Hi I want to display a variable menber array queue, and the definitions of the class are The Array.h

template <class DataType>
class Array
Array( int size );

T *ele;

The Array.cpp

Array<T>::Array( int size )
if ( size < 1 ) {
capacity = 1;

else {
capacity = size;


ele = new T [capacity];


#include "Array.h"
template <class T>
class Queue
Queue( );
void enqueue( T ele );
Array<T> ele;
int front;
int back;


template <class T>
Queue<T>::Queue( )
: ele( 2 ), front( -1 ), back( -1 )
template <class T>
void Queue<T>::enqueue( T ele )

in the main I have

// I declare a function template fro display the queue
template <T>
void Disply(const DataType elem[] )

for( int i = 0; i<6; i++)

cout<< "The elements of the Queue are:\n", i , elem[i]<<endl;


int main()

Queue<int> elementsArQueue;

int array[]={1,2,3,4,5,6};

for (int a=0;a<6;a++)


Display(elementsArQueue.);// give to me some errors like


In function int main():
P.cpp:48: error: no matching function for call to Display(Queue<int>&)

Recommended Answers

All 2 Replies

Check out:

It's touchy about template parameters being defined in separate compilation units. It probably has to do with your DataType parameter being used in a function with your T parameter in main. I did not try your code so I'm not positive.

P.S. What's up with that font? hehe

There are many other things, but you need to have template <class T> before every function definition that uses T (e.g. in array.cpp). Also you pull capacity out of thin air. Make sure your function names are spelled correctly as, within the code you posted you have "Disply" as your function name.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.