c++ - Can we declare a function with the same signature but different return type in the base class? -


the question may silly ,but want ask.. there way can declare method in class same signature different return type (like int fun(int) , float fun(int) ) , during object creation can dynamically decide function executed! have got compilation error...is there other way achieve logic may using templates...

you can take return value template.

template<typename t> t fun(int); template<> float fun<float>(int); template<> int fun<int>(int); 

can decide dynamically @ run-time call? no.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -