Tuesday, 15 June 2010

c# - Defining and calling a method -



c# - Defining and calling a method -

i new oop. hope clarify doubt.

if want phone call method like

int number = numbermethod();

what should method definition??

public void numbermethod(out int num) { num = 3; }

or

public int numbermethod() { int num = 3; homecoming num; }

or both definition same??

second one,

because calling method below means calling method retuns value

int number = numbermethod();

method

public int numbermethod() { int num = 3; homecoming num; }

if want user first 1 need phone call

int number ; numbermethod(out number);

because having void homecoming value , specifying out in param

method

public void numbermethod(out int num) { num = 3; }

c#

No comments:

Post a Comment