<div dir="ltr"><div><div><div>One of the reasons I dislike C++.... It looks like C, but it isn't.<br><br></div>IIRC, struct in C++ is exactly the same as class except struct is default public while<br></div>class is default private. ie structs can have member functions, inheretance etc.<br><br></div>However, by convention, struct should only be used for "dumb" C style structures and class for everything else. Public flogging for anyone that inherits from a struct or adds member functions.<br><br><div><div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 26, 2016 at 10:59 PM, Paul Davey <span dir="ltr"><<a href="mailto:plmdvy@gmail.com" target="_blank">plmdvy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Sep 26, 2016 at 3:47 PM, Volker Kuhlmann<br>
<<a href="mailto:list0570@paradise.net.nz">list0570@paradise.net.nz</a>> wrote:<br>
snip<br>
<span class="">><br>
> Paul I don't know if the aggregate initialisation works for private<br>
> members (it should), the class should still be assignable, privates<br>
> included. But yes I stripped down 1 line too many, and it should be<br>
><br>
>    class values {<br>
>      public:<br>
>        ...<br>
><br>
<br>
</span>C++ has a bunch of rules for when you can use a class/struct like a C<br>
struct, one of them is it must have no non-public members, also no non<br>
trivial constructors or destructors and a few other things, I got that<br>
restriction by looking here<br>
<a href="http://en.cppreference.com/w/cpp/language/aggregate_initialization" rel="noreferrer" target="_blank">http://en.cppreference.com/w/<wbr>cpp/language/aggregate_<wbr>initialization</a>. </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Also the point about not caring about how few members you give to the<br>
initialiser is inherited from C which will just 0 any fields not<br>
given.<br>
<br>
Cheers,<br>
Paul<br>
<div class="HOEnZb"><div class="h5"><br>
______________________________<wbr>_________________<br>
Chchrobotics mailing list <a href="mailto:Chchrobotics@lists.linuxnut.co.nz">Chchrobotics@lists.linuxnut.<wbr>co.nz</a><br>
<a href="http://lists.ourshack.com/mailman/listinfo/chchrobotics" rel="noreferrer" target="_blank">http://lists.ourshack.com/<wbr>mailman/listinfo/chchrobotics</a><br>
Mail Archives: <a href="http://lists.ourshack.com/pipermail/chchrobotics/" rel="noreferrer" target="_blank">http://lists.ourshack.com/<wbr>pipermail/chchrobotics/</a><br>
Meetings usually 3rd Monday each month. See <a href="http://kiwibots.org" rel="noreferrer" target="_blank">http://kiwibots.org</a> for venue, directions and dates.<br>
When replying, please edit your Subject line to reflect new subjects.<br>
</div></div></blockquote></div><br></div></div></div></div></div>