I am working on a project on data structures. Firstly, I wrote everything basically, but it looks like C. But, as I found out, I tried to think about OOP and do as little as possible in my main () methods.
I implemented some operation in my class, for example, add, remove, find.it is too easy to implement.
class ARB
{
private:
struct BT
{
int data;
BT *l;
BT *r;
};
struct BT *p;
public
ARB();
~ARB();
void del(int n);
void add(int n);
};
void ARB::del(int num)
{
};
main()
{
BTR T;
T.add(3);
T.add(5);
};
But I came to a big program How to define a method that should use a binary tree and get a stack
STACK ARB::MyFunct(BT* p)
{
}
How can I apply it in the main program
main()
{
BT T;
T.add(3);
T.add(5);
STACK S;
BT* p
S=T.MyFunct(p);
};
** mention: I implement the STACK class
source
share