Dear all,

The only reason I posted the whole code was to give one the chance to run the program and see in practice the problem.
But I guess you are right, that is too much.
Anyway,
The implementation of the two functions is:
Code:
//It returns the member.
Member* AssociationList<Book,Member>::get_member(Book* book)
{
	Member* member=0;
	bool searching=true;
	int index=0;

	while(searching)
	{
		if (this->association_list[index])
			if (this->association_list[index]->linked_book()==book)
			{
				member=this->association_list[index]->linked_member();
				searching=false;
			}
			else
				index++;
		else
			index++;
		if (searching && (index == LIST_SIZE))
		{
			searching=false;
		}
	}
	return member;
}
Code:
//it returns the book
template<class Book,class Member>
Book* AssociationList<Book,Member>::get_book(Member* member)
{
	Book* book=0;
	bool searching=true;
	int index=0;

	while(searching)
	{
		if (this->association_list[index])
			if (this->association_list[index]->linked_member()==member)
			{
				book=this->association_list[index]->linked_book();
				searching=false;
			}
			else
				index++;
		else
			index++;
		if (searching && (index == LIST_SIZE))
		{
			searching = false;
		}
	}
	return book;
}
The template file that I use to display the books is:
Code:
template<class Object>
void List<Object>::displayElement(char* type)
{
	if (num_elements == 0)
		cout<<"No "<<type<<" is found in the "<<type<<" array.\n";
	else
		for(int element=0; element<this->num_elements; element++)
		{
			cout<<'\n';
			this->element_list[element]->display(association_list.get_member(element_list[element]));
		}
}
But it does not work for Members. I've tried to use the recommendations you've told me but it seems not to work.


The program works ok, when I call the functions:
book1.addElement("Books"); and book1.displayElement("Books");
to add a book and to display them respectively.

But when I use the :
member1.addElement("Member"); and member1.displayElement("Member"); it dispalys the problem:

The compiler complains at the point:
this->element_list[element]->display(association_list.get_member(element_lis t[element])); saying that : get_member: cannot convert parameter one from Class Member* to class Book*.


Can you correct any mistakes or suggest any solutions?
Best Regards,
grscot