Is there any way you could use ref in the method but not in the call? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Is there any way you could use ref in the method but not in the call?

For example if you wanted the variable to change sometimes but not others. Or would you need two different methods for that?

17th Jul 2016, 7:21 AM
Connar
Connar - avatar
4 ответов
0
sounds like you want to use pass by value. not sure tho
17th Jul 2016, 10:41 PM
Emmett
0
@Emmett I have no idea haha. So new to this that I'm crazy confused
17th Jul 2016, 11:02 PM
Connar
Connar - avatar
0
@Al Connar just overload the method
18th Jul 2016, 10:14 PM
Ивелин Коцев
Ивелин Коцев - avatar
0
Try it yourself, and you'll see that you'll get an error message if you include ref only in the definition. You would most likely need two different methods. Perhaps you could get away with a single method and named arguments, but it would not be pretty.
20th Jul 2016, 2:59 AM
Anders
Anders - avatar