The current situation is this: I am going through some code re factoring
If you look at the image the current situation is that I have a virtual method setData(int ID);
now we want to change that to a virtual method setData(dataObj aObj);
But doing so, is a long process since, our foo
object has been inherited by tons of classes. So, we want to gradually make the code change.
As such, what I need to do is to check if one of the inherited classes has implemented
setData(dataObj aObj)
call that class, else call the other previous function signature
setData(int ID);
The problem is further complicated by the fact that, FOO
class provides a default setData(int ID)
previously and not all classes that inherit from FOO
thus may/may not need to implement setData
and their implementations do vary wildly.
I have already looked at How to Check if the function exists in C/C++ unfortunately, that does not answer my questions.
In some of the posts I have seen people use templates, that's not an option for me, since this needs to be done at runtime. The other options seems to suggest linking /mangling tricks with GCC etc. I need to build my code to be platform and compiler independent. So that's not an option either.
Any more suggestions, the only possible close solution seems to be https://stackoverflow.com/a/8814800/1376317 But I am really not sure how to implement this in my workflow, or whether this is even relevant to my problem.