如何将一个函数作为参数传递给C ++中的另一个函数?

时间:2017-09-17 14:24:42

标签: c++ functional-programming

函数被认为是C ++中的第一类对象。 如何在C ++中复制以下pyhton代码?

def print_wrapper(a):
    print(a)

def execute_function(func, arg):
    return func(arg)

execute_function(print_wrapper, 'test_argument')

请注意,函数print_wrapper作为参数传递给函数execute_function

0 个答案:

没有答案
相关问题