So I have a class made in c++ and need to convert it into vb.net but I got problem converting a certain part of a function.
void deg_min_sec2decimal(double deg, double min, double sec, double& dec_deg)
{
dec_deg = (deg+min/60.0+sec/3600.0);
}
What type of variable is “double&”, I know a double but what’s with the “&”?
It isn’t ” double &dec_deg” so it isn’t an adres (pointers ect.)?
and how would i convert that to vb.net?
Grtz
It’s a reference. That means that whatever you set the value to inside the function, the original variable that was passed in from outside will have that value.
You can convert this to VB by using
ByRefor making the function return the result of that expression instead of taking thedouble&, and setting the variable you would have passed in to the result of the function.So if you had this before:
You’d change that to
(I don’t know VB so that syntax might be wrong, but you get the idea.)
I’d go with the latter because returning things through arguments is usually only used when you need more than one return value, and that function isn’t even returning anything.