I essentially have a cyclic dependency problem where a function uses an object object and the object uses said function. Is there any way to resolve this without working around it?
//function that uses struct
void change_weight(Potato* potato,float byX) { potato->weight+=byX; }
//said struct that uses said function
struct Potato
{
float weight=0.0;
Potato(float weightin) { change_weight(weightin); }
};
Note that I understand this example is silly, but this example only contains the "essence of the problem" which has come up in much more complex situations where I would sometimes not know how I would work around it or even if it could be worked around, and it would be very convenient to just be able to do it. I am asking if there is a way to do this without working around it.