given Struct Point :
public struct Point {
double x, y;
Point(double i, double j) {
x=i;
y=j;
}
}
Q1:whats the diffrence between:
Point p;
and
Point p=new Point(2.0,3.0);
as i understood it, in the second part annonymous Point struct is being allocated on the heap, and is being copied bit by bit to the p variable's memory allocated on the stack. am i correct?
Q2:what do i need to do to carry reference to Point instead of allocating it on stack and passing it around by value? (without using unsafe pointers)
class Linear {
private double m, n;
ref Point p = new Point(2.0,3.0); // not compiling
}