0
void BinarySearchTree::inorder(tree_node* p)
{
    if(p != NULL)
    {
        if(p->left) inorder(p->left);
        cout<<" "<<p->data<<" ";
        if(p->right) inorder(p->right);
    }
    else return;
}

This sample of code works fine if I use it to test valuables that are primitive, example: integer
I wanted to be able to transform that, so, if for example when I was using a class 'Product', which includes a Price (integer) and Description(string), would allow me to order the products per price.

If you could give me an idea how to make this possible I'd appreciate it.
Thanks.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Diogo Martinho
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.