70,017
社区成员




#include <cstdio>
using std::printf;
class ff {
public:
explicit ff(int value = 3)
: value_(value) {}
void operator()() {
printf("%d\n", value_);
}
private:
int value_;
};
void fff(ff f) {
f();
}
int main() {
fff(ff());
return 0;
}
void ff(int a=3)
{
printf("%d",a);
}
void fff(void(*f)(int))
{
f();
}
int main()
{
fun1();
fff(ff);
getchar();
return 0;
}
#include <iostream>
using namespace std;
void fun(int a,int b=0)
{
cout<<"hello"<<endl;
}
int main()
{
void (*p)(int,int);//定义函数指针
p=fun; //函数名是地址,和数组名一样
p(0,0); //用指针调用函数
return 0;
}
void fun(int a,int b=0)
{
}
typedef void (*pfun)(int, int);
int main()
{
pfun funImpl = &fun;
funImpl(1, 1);
return 0;
}