Question on pfVec3. Need explanation.

New Message Reply Date view Thread view Subject view Author view

Nuno Godinho (mgo++at++minerva.inesc.pt)
Tue, 05 Mar 1996 22:55:56 +0100


Hi.

I learned that a class should hide its variables allowing access only
through class methods.

Why does pfVec3, being a class, allow access to its 3 components.

And since this happens what is the difference between these two sources:

a)

        pfVec3 p;
        p.set(1.0f, 2.0f, 3.0f);

b)
        pfVec3 p;
        p[0]=1.0f;
        p[1]=2.0f;
        p[2]=3.0f;

Is b) faster than a)?

-------------

Not knowing a lot about C++ I find it would be normal for a pfVec3 class
definition to be present in one of the header files. I didn't find it
anywhere. Where are the pfVec3 methods defined? I found pfVec3 to be
defined as

typedef float pfVec3[3];

Why is this?

thanks in advance
        Nuno


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:52:31 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.