I have a homework to build on paper a parameter marshaling protocol to be suited to call a method with one variable, or with an array (like a polymorphism).
procedure(var1)
procedure(arra开发者_运维技巧y1)How would you define the protocol? How about the method in C++
You could try to make the functions with Object parameters. i.e
void myFunction(void* param, int paramType)
{
if(paramType == definedTypes[0] )
{
// do stuff
}
else if(paramType == definedTypes[1])
{
//do something else
}
}
you pass 2 parameters: in the first your object, in the second the type of your object, you have to define for example in an array what types of data are you interested in.
精彩评论