Template question

Started by
1 comment, last by rhide 20 years, 9 months ago
Im reading "Teach yourself C++ in 21 days" at the moment, and I have reached the 19th day. There is a code piece I really cant understand in that chapter:

template <class T>
bool operator== (const T& lhs, const T& rhs)
{
  //I dont understand this if-statement ...

  if (lhs.CellsInLinkedList() != rhs.CellsInLinkedList())
    return 0;

  ... // more code


  return 1; // if nothing went wrong

}
This operator is declared as friend to a linked list named LinkedList. This means LinkedList would give access to the class functions, and T alone should give access to the parametirized type (int, char, cAnimal, whatever). What I dont understand is how in the world "const T& lhs" and "const T& rhs" can give access to the entire classes ??? Please help me straighten this out! [edited by - rhide on July 28, 2003 8:49:11 PM]
The hackers must have gotten into the system through the hyperlink !!
Advertisement
Forget about my question, It was 03:30 PM (local time) when i posted this message, but i realized my wrong not very long time aftewards.

The parameter was a function (LinkedListNode), lol
The hackers must have gotten into the system through the hyperlink !!
Just curious, how many days did it take for you to reach until the 19th day of the book? :-)

I''m from sweden too

Albert

This topic is closed to new replies.

Advertisement