> >>A struct is nothing more than a public class.
> That's funny, I always thought a class was nothing more than a private
> struct.;)

You could, but you'd be wrong.  :)     You can't do this with C, for
example:

class RecordPtr
{
public:
    RecordPtr(MemHandle mh):_mh(mh),_p( MemHandleLock(mh) ) { }
    ~RecordPtr() { if (_p) MemHandleUnlock(_mh); }

    operator MemPtr() { return _p; }
protected:
    MemHandle _mh;
    MemPtr _p;
};


Locking and unlocking handles is guaranteed by the compiler, rather than you
scanning your code manually and making sure that the number of locks ==
number of unlocks.

Yes, you can get rid of the "protected" and "public" and change the "class"
to "struct", but you still need a C++ compiler to compile it!  So even
though you're not using class, you'd still be using C++.

Herry



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to