I have the following code:
Code:
template <class T> class List
{
public:
List *urm;
T *info;
List();
~List(){
delete(this->urm);
}
List<T>* Add(List* ,T*);
};
template <class T> List<T>::List()
{
urm=NULL;
info=NULL;
}
template <class T> List<T>* List<T>::Add(List *head,T *elem)
{
List *aux;
if (head==NULL){
head=new List<T>;
head->info=elem;
}
else {
aux=new List<T>;
aux->info=elem;
aux->urm=head;
head=aux;
}
return head;
}
int main ()
{
List<int> *h=NULL;
int a=1;
h=h->Add(h,&a);
return 0;
}
I don't see why it is not compiling