J*****n 发帖数: 48 | 1 I need to let function A be an argument for function B,
but function A has two forms (override), how can I
include the two types as a general form of A in argument of B?
for example
float A(int);
float A(int, double);
I want
float B((*A)(?),other arguments)
how do I substitute content denoted by "?" | p***o 发帖数: 1252 | 2 Then how to call them in B?
【在 J*****n 的大作中提到】 : I need to let function A be an argument for function B, : but function A has two forms (override), how can I : include the two types as a general form of A in argument of B? : for example : float A(int); : float A(int, double); : I want : float B((*A)(?),other arguments) : how do I substitute content denoted by "?"
| J*****n 发帖数: 48 | 3 you are right, this design is problematic.
【在 p***o 的大作中提到】 : Then how to call them in B?
| Q**g 发帖数: 183 | 4 可以用function object吧
class A{
float operator()(int){...}
float operator()(int, double){...}
}
然后传一个A的实例的指针给B.
【在 J*****n 的大作中提到】 : I need to let function A be an argument for function B, : but function A has two forms (override), how can I : include the two types as a general form of A in argument of B? : for example : float A(int); : float A(int, double); : I want : float B((*A)(?),other arguments) : how do I substitute content denoted by "?"
|
|