Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-04-14 17:58:38


"Robert Ramey" <ramey_at_[hidden]> wrote in message
news:20040414170207.5A5BB3150A_at_acme.west.net...
> Thorsten Ottosen wrote:
>
> > class gps_position
> > {
> > public:
> > int degrees;
> > int minutes;
> > float seconds;
> > gps_position(){};
> > gps_position(int d, int m, float s) :
> > degrees(d), minutes(m), seconds(s)
> > {}
> > };
>
> > I think it should be stated that this is not recommended practice, ie,
> > this class has a non-trivial invariant and should not have public
members.
>
> I might add a friend rather than use public. But this small code snipet
is
> used to illustrate the non-intrusive serialization - nothing more. BTW
the
> actual demo programs don't use this. What is the non-trivial invariant
> here?

I assume that not all data members can have arbitrary values. How many
seconds
to a minute before the seconds should be reset etc.

> Anyway, I'll consider adding some comments to remind the reader of the
> intended purpose of he tutorial example.

Thanks.

br

Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk