[CSI] Question: What do structure variables store?

Mikhail Nesterenko mikhail at cs.kent.edu
Sun Aug 15 16:54:17 EDT 2021


> I have a question about structure variables, what do structure
> variables store? I know that objects store the state of the
> object. Would structure variables store the values of all the member
> variables?

Indeed. A structure variable stores the values of all its member
variables.


We have not talked about it, but in C++ there is little difference
between structures and classes: one can declare methods, constructors
and all the good things for structures also.

The main difference is by default (without explicitly stating the
access specifier - either public: or private:) all the members in the
structure are public while all the members of the class are private.

Thanks,
--
Mikhail


More information about the cs13001 mailing list