© { JSL }
40
Problem?
·
a reference can bind to a value
w
does the reference refer into the stack?
w
if so what happes when the scope ends?
struct
Pair
{
public int
X, Y;
...
}
class
Example
{
static object
Dangle()
{
Pair p =
new
Pair(1,2);
object
o = p;
return
o;
}
static void
Main()
{
object
o = Dangle();
...
}
}
p.X
stack
1
2
@
o
p.Y
?