M
Michael
Ok,
When can i return by reference? For the sake of simplicity:
lets say I have a class MLine:
class mv3
{
public:
float x,y,z;
};
class MLine
{
mv3 PtOnLine;
mv3 Direction
public:
MLine();
const mv3& GetDirection() const
{
return Direction;
}
};
is this OK? I appreciate that in nots of cases this can be dangerous, eg if
I returned (Direction *4) as a tempory object would be created with local
scope then returning a reference to an invalid object.
Thanks
Mike
When can i return by reference? For the sake of simplicity:
lets say I have a class MLine:
class mv3
{
public:
float x,y,z;
};
class MLine
{
mv3 PtOnLine;
mv3 Direction
public:
MLine();
const mv3& GetDirection() const
{
return Direction;
}
};
is this OK? I appreciate that in nots of cases this can be dangerous, eg if
I returned (Direction *4) as a tempory object would be created with local
scope then returning a reference to an invalid object.
Thanks
Mike