I want to produce a void method that takes other void methods as parameters so that I can call them individually in a case-by-case basis. This method will be accessible by child classes that can call the function by name while passing void methods into it.
Like so:
public class parent_class
{
...
protected void like_an_action_delegate (Action/void function_a(), Action/void function_b(), ...)
{
if (condition_1)
{
function_a();
}
else if (condition_2)
{
function_a();
}
...
}
}
}
//new script
public class child_class : parent_class
{
Update ()
{
like_an_action_delegate (void_function_a(), void_function_b(), ...);
}
...some void methods here...
}
This is important because I want to be able to inherit a function that maps different functions to a set of keys (on the keyboard) like I said in a case-by-case basis.
EDIT: Thanks for introducing me to params, I'm going to learn it and report back.