I want to determine if a function definition actually exist in a class and call that function only if it exists (not just declared). Idea is function declaration will always be present in the class header file but it's implementation (function definition) may or may not be included in the compilation based on the some flags. Catch is that I can not use compiler flags in the source cpp files. Below is what I want to achieve:
class Base {
    public:
    void feature1(int x); // Definition always present
    void feature2(int y); // Definition always present
    void feature3(int z); // Definition may (or may not) be present in another cpp file / library 
};
int main(int argc, char *argv[]) {
    Base a1;
    if (a1.feature3 is available) {  // pseudo code 
        a1.feature3(5); 
    } else {
        printf("feature3 is not available\n");
    }
    return 0;
}
Can someone please help with a possible solution.
 
     
    