[chbot] Programming 8-bit microcontrollers
Paul Davey
plmdvy at gmail.com
Mon Sep 26 10:59:16 BST 2016
On Mon, Sep 26, 2016 at 3:47 PM, Volker Kuhlmann
<list0570 at paradise.net.nz> wrote:
snip
>
> Paul I don't know if the aggregate initialisation works for private
> members (it should), the class should still be assignable, privates
> included. But yes I stripped down 1 line too many, and it should be
>
> class values {
> public:
> ...
>
C++ has a bunch of rules for when you can use a class/struct like a C
struct, one of them is it must have no non-public members, also no non
trivial constructors or destructors and a few other things, I got that
restriction by looking here
http://en.cppreference.com/w/cpp/language/aggregate_initialization.
Also the point about not caring about how few members you give to the
initialiser is inherited from C which will just 0 any fields not
given.
Cheers,
Paul
More information about the Chchrobotics
mailing list