Thursday, June 14, 2012

Argument ve Parameter arasındaki fark

Argument : Values of expressions passed to a method.
Difference Between Parameters and Arguments

Parameter ve argument çoğu zaman birbirleri yerine kullanılabilir.Ancak bu ikisi farklı kavramlardır. Method definition'ında , methodun alabileceği parameter type ve variable name 'i belirtiriz.Method'u çağırırken methoda gönderdiğimiz değerler argument'tir. 

(Parameters refer to the local names in the callee. Arguments refer to the values passed by the caller.)

Örnek:
 int add( int a, int b )
   {
   // a and b are 'parameters', the variables the callee uses to accept inputs.
   return a + b;
   }

// 2 and 3 are 'arguments', the values passed by the caller.
int result = add( 2, 3 );

No comments:

Post a Comment