|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
<< overloading of Binary Search Tree
I am attempted to overload the << operator for a binary search tree and have run into a snag. Does anyone have any ideas on how to accomplish this? Does anyone know of any examples or could someone provide one? In the end, I hope to be able to have the user choose the order to print the nodes (preorder/inorder/postorder).
Here are my class definitions for the search tree, in case they help. class binarySearchNode { friend class binarySearchTree; int value; // Value store by the node binarySearchNode * leftChild; binarySearchNode * rightChild; BinarySearchNode(int val); }; class binarySearchTree { binarySearchNode * root; int order; // Order of traversal public: ... // Omitted the member functions friend ostream & operator << (ostream &, const binarySearchTree &); }; I've tried to call a recursive member function from the operator << method, but have not been able to make it work myself. I hope someone can help me out. If anymore information is required, I would be happy to provide it. Thanks in advance for any help anyone may provide. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > << overloading of Binary Search Tree |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|