Answer the question
In order to leave comments, you need to log in
Handling slightly different structures with one function in C++
Help a newbie. There are two structures:
struct valuenode {
char elements [5];
int power;
};
struct indexnode {
char elements [5];
int elementindex [10];
};
int pushlevelnodes (valuenode * valuesarray,int beginatindex=0,char toplevel=1) {
Answer the question
In order to leave comments, you need to log in
template method? Or inherit these two structures from a common ancestor?
Why wouldn't you do that?
You can give the function an array of char* elements as an input.
And call from valuenode.elements and indexnode.elements.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question