I have written the following member function of a class Point
double &Function(){
double d=33.66;
double *p=new double;
p=&d;
return *p;
}
which is being called in the main () using Point object "pt" as, pt.Function(). This works, although I don't quite understand why? Can it be improved? I know this is not the best way to get the value of "d" but I use it to learn how to pass values using reference. Thanks for your help.