Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

How to return reference of value from function?

3 réponses
Avatar
Levan Jgarkava
Hi!

How can I return reference of value from function, so, that I could modify
it? One method I know is to use a sub with ByRef value as last parameter,
but is there better solution? Can I use ByRef return values?
Here's example in C++:
----
int a = 10;

int& somefunc()

{

return a;

}

void main()

{

int& c = somefunc();

c = 20; // a = 20

printf("a = %d\n", a);

int& d = somefunc();

d = 30; // a = 20

printf("a = %d\n", a);

}

----
So, how can I do same thing in VB?

I'll be grateful for any help...

--
Best Regards,
Levan Jgharkava

PS: There are 10 types of people in this world, those that understand
binary, and those that don't ;)

3 réponses

Avatar
Armin Zingler
"Levan Jgarkava" schrieb

How can I return reference of value from function, so, that I could



Don't include all those newsgroups in your question! This
(microsoft.public.de.vb) is a German speaking group. Also don't include all
the other groups because they are Chinese, French and so on.


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
Avatar
Knuth Konrad
Hi there

Levan Jgarkava wrote:
How can I return reference of value from function, so, that I could modify
it? One method I know is to use a sub with ByRef value as last parameter,
but is there better solution? Can I use ByRef return values?



Simple enough:

Function SomeFunc(ByVal lInput As Long) As Long

SomeFunc = lInput

End Function


Knuth
Avatar
Zoury
> Don't include all those newsgroups in your question! This
(microsoft.public.de.vb) is a German speaking group. Also don't include


all
the other groups because they are Chinese, French and so on.



hehe! I'd even say don't include *any* of these groups in your question
since none of them is intended for english-speaking people. :O)

See those groups for future english assistance :

microsoft.public.vb.general.discussion
microsoft.public.vb.syntax
microsoft.public.vb.winapi
microsoft.public.vb.....

--
Best Regards
Yanick Lefebvre