I am trying to write use pointers for some function arguments. The reason I am using pointers and not references is that either the src or dst arguments might be NULL.
Code:
Vec3 TFormPoint(const Vec3& point, Entity* src, Entity* dst)
{
Mat4* srcmat;
Mat4* dstmat;
if (src!=0) {
srcmat = src.mat;
}
if (dst!=0) {
dstmat = dst.mat;
}
//do some more stuff
}
The entity class looks like this:
Code:
class Entity
{
public:
Entity();
Mat4 mat;
}
Why is the compiler complaining that "left of '.mat' must have class/struct/union"? How do I convert the reference to a pointer? What should this code look like?