StatCounter

View My Stats

Tuesday, February 10, 2009

what is Wrapper?

what is Wrapper?


We overwrite the original function into user friendly function.That function is called as wrapper.


For Example below consider the original function have 5 argument and it process those five argument


public void originalFunction(string arg1,string arg2,string arg3,string arg4,string arg5)
{
//Some processing happening by the use of those parameter
}


For the above example consider if we only often need to send 3 parameters. we no need to send another 2 parameters.

We can create a wrapper function and internally get call that original function:

Example:

public void WrapperFunction(string arg1,string arg2,string arg3,"","")
{
originalFunction(string arg1,string arg2,string arg3,"","");
}


For above WrapperFunction is a "Wrapper" for originalFunction. Above we just hard coded the unnecessary last 2 arguments.

No comments: