京东选择-函数指针

void(*function)(float);
void One(float one){
    cout << one << endl;
}
void Two(float two){
    cout << two << endl;
}
void Three(float three){
    cout << three << endl;
}
int main(){
    function = One;
    function(1);
    function = Two;//函数指针指向可变
    function(2);
    function = Three;
    function(3);
    return 0;
}

 

posted @ 2018-09-09 21:43  aote369  阅读(135)  评论(0编辑  收藏  举报