Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ At runtime check whether function signature exists?
    primarykey
    data
    text
    <p>The current situation is this: I am going through some code re factoring </p> <p><img src="https://i.stack.imgur.com/5dWvc.png" alt="enter image description here"></p> <p>If you look at the image the current situation is that I have a virtual method <code>setData(int ID);</code> now we want to change that to a virtual method <code>setData(dataObj aObj);</code></p> <p>But doing so, is a long process since, our <code>foo</code> object has been inherited by tons of classes. So, we want to gradually make the code change.</p> <p>As such, what I need to do is to check if one of the inherited classes has implemented <code>setData(dataObj aObj)</code> call that class, else call the other previous function signature <code>setData(int ID);</code> The problem is further complicated by the fact that, <code>FOO</code> class provides a default <code>setData(int ID)</code> previously and not all classes that inherit from <code>FOO</code> thus may/may not need to implement <code>setData</code> and their implementations do vary wildly. </p> <p>I have already looked at <a href="https://stackoverflow.com/questions/8814705/how-to-check-if-the-function-exists-in-c-c">How to Check if the function exists in C/C++</a> unfortunately, that does not answer my questions. </p> <p>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. </p> <p>Any more suggestions, the only possible close solution seems to be <a href="https://stackoverflow.com/a/8814800/1376317">https://stackoverflow.com/a/8814800/1376317</a> But I am really not sure how to implement this in my workflow, or whether this is even relevant to my problem. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload