<pre>
Dear all,
I can't borrow a book even though the code does not have any error. When I try to display the book details along with the member's name (in case the member has borrowed the book), I can't display the member's name, but only the book details and a message: "no member has...
Dear all,
All I'm trying to do is to enter 3 books from the keyboard to an array and then traverse the array to display the elements and also prompt the user to enter the book names to delete them from the array(if the book exists into the array).
The code that adds to the array is...
Dear all,
I have two template functions for displaying books and members respectively from arrays.
template<class Object>
void List<Object>::displayBook(char* type)
{
if (num_elements == 0)
cout<<"No "<<type<<" is found in the "<<type<<" array.\n";
else...
Instead of having two functions, to display the members from the member array and the books from the book array, I have to use one template function to perform both operations(if this is possible). I don't know if this is possible, so that is why I'm posting my problems.
Regards,
grscot
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:
//It returns the member.
Member*...
Dear all,
The concept behind the code is:
There is an associationlist that holds association pointers. Each association pointer has two pointers, that point to a book
and to a member object respectively.
Now what I'm trying to do is:
To have the association pointer to use its two pointers to...
Dear all,
The concept behind the code is:
There is an associationlist that holds association pointers. Each association pointer has two pointers, that point to a book
and to a member object respectively.
Now what I'm trying to do is:
To have the association pointer to use its two pointers to...
Dear all,
I have two functions:
a) Member* get_member(Book* book);
b)Book* get_book(Member* member);
The implementation code for the function prototypes is:
a)
template<class Book,class Member>
Member* AssociationList<Book,Member>::get_member(Book* book)
{
Member* member=0;
bool...
Dear all,
I have two functions:
a) Member* get_member(Book* book);
b)Book* get_book(Member* member);
The implementation code for the function prototypes is:
a)
template<class Book,class Member>
Member* AssociationList<Book,Member>::get_member(Book* book)
{
Member* member=0;
bool...
Dear all,I'm really sorry for asking again about the same thing, but I don't really undersatnd what's going on with the templates.
I've tried to use the template<class R, class P>
R* get_member(P* pArg)
as adviced, but it seems that my program is more complicated.
So, I...
Dear all,
I 've understood that the template function for the two functions :
int AddNumbers(int a, int b);
float AddFloats(float a, float b);
is: template<class T>
T Add(const T &a, const T&b)
{
return a+b;
}
because the arguments' return type is the same as the functions' return type...
Dear all,
I would like to ask if it is possible to have a template function as a general function for two functions that have a different return type.
For example:
int AddNumbers(int a, int b);
float AddFloats(float a, float b);
What would it be the template function for the above example...
Dear all,
In the menu, I can add members in a memberlist and display them, using the function :
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...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.