Support to "return (*vPoint)";
Memorization must be global and should adinistrated so that it satisfys the below:
vPoint vTriangle::getNormal() { vPoint nrml; vPoint ap, bp; vCalculation *cal = nullptr; cal = new vCalculation (); ap = cal->subtract( p2 , p1 ); bp = cal->subtract( p3 , p1 ); nrml = cal->cross( ap, bp ); nrml = cal->normal( nrml ); this->normal = &nrml; delete( cal ); return nrml; }
We would use covinient local memorization but lose "return (vPoint*)" under vCalculation because which is copied and memorized until this program stops.
But we could see and feel like a lot that the above codes is OK so that we do not use "operator=".
--- compilation error ---
vTriangle.cpp:18:28: error: no match for 'operator=' (operand types are 'vPoint' and 'vPoint*')
nrml = cal->cross( ap, bp );
^
In file included from vTriangle.cpp:1:0:
vPoint.h:5:7: note: candidate: constexpr vPoint& vPoint::operator=(const vPoint&)