Posted By

itsok2kry on 10/17/08


Tagged


Versions (?)

Linked List (LinkedNode.cpp)


 / Published in: C++
 

Not working.

  1. #include "LinkedNode.h"
  2. #include "LinkedList.h"
  3.  
  4. // linked node functions
  5.  
  6. //constructor
  7. template < class T >
  8. LinkedNode< T >::LinkedNode( LinkedList< T > plist, LinkedNode< T > pNode, T * val )
  9. {
  10. // set our values, our associated list, and our previous node
  11. value = *val;
  12. list = plist;
  13. previousNode = pNode;
  14.  
  15. previousNode->setNextNode( this );
  16. }
  17.  
  18. // return the next node
  19. template < class T >
  20. LinkedNode< T > * LinkedNode< T >::next( void )
  21. {
  22. return nextNode;
  23. }
  24.  
  25. // return previous node
  26. template < class T >
  27. LinkedNode< T > * LinkedNode< T >::previous( void )
  28. {
  29. return previousNode;
  30. }
  31.  
  32. //return our value
  33. template < class T >
  34. T LinkedNode< T >::getValue( void )
  35. {
  36. return &value;
  37. }
  38.  
  39. // set our next node (this is called by the next node to be set up)
  40. template < class T >
  41. void LinkedNode< T >::setNextNode( LinkedNode< T > next )
  42. {
  43. nextNode = &next;
  44. }

Report this snippet  

You need to login to post a comment.