#include<iostream>
#include<cstdlib>
#include<string.h>
using namespace std;
template<typename X>class list
{
    X *l[10];
    public:
        void insert(X *ele);
        void display();
};
template<typename X>void list<X>::insert(X *ele)
{
    static int i;
    l[i]=ele;
    i++;
}
template<typename X>void list<X>::display()
{
    static int i;
    cout<<"\nThe Name #:"<<i<<"\t"<<*l[i]<<endl;
    i++;
}
int main()
{
    string s;
    list<string> l1;
    cout<<"\nEnter Name:\t";
    cin>>s;
    l1.insert();
    l1.display();
    cout<<endl;
    system("pause");
    return 0;
}

I've to create a class template for a list for storing names or numbers. Also i've to use insert, delete and display functions (template functions) for the same. However, the program is throwing an error.
[Error] no matching function for call to 'list<char*>::insert(const char [6])'
Pls help me with this!
Also my concepts when it comes to template class is not much good.F\If u know any good books for the same,pls do share. Taking multiple data members in a template class and using them like the way we use it in a regular class;that's my point of doubt.Thanks in advance

Be a part of the DaniWeb community

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