[Qt-interest] struct & class
Ross Driedger
ross at earz.ca
Tue Nov 17 06:34:57 CET 2009
On Tue, 17 Nov 2009 00:07:56 -0500, navid navid <n_nnavid at yahoo.com> wrote:
> Dear Ross
>
> Thanks for favor.
> bay the way, I till can not find on the web how to define a constant
> struct. the following code produce error:
> const SETPOINT unsuccess_setpoint={0.0,0,0.0,0};
> also, when define {const SETPOINT unsuccess_setpoint;}, it is impossible
> to initialize members at constructor.
No, that will not work.
To make an object const, you declare it as such and use the constructor
you want. That constructor must use its intitalization list. But that
kind of use is fairly rare.
Const objects usually come into play when accessing existing objects
through const references or pointers.
Ross
--
"Wagner's music has some wonderful moments but awful half hours. "
Gioacchino Rossini
Ross Driedger
ross_at_earz.ca
More information about the Qt-interest-old
mailing list