This section contains 714 words (approx. 3 pages at 300 words per page) |
The "struct" data type is specific to the C and C++ programming languages. The original data type came from C and then was subsumed into C++. While the C++ version retains the original semantics and syntax of the original, it has been extended to make C++ structs bona-fide objects in their own right.
Structures contain a set of contiguously allocated member variables that can be of any type, including other structures. In C++ structures may have member functions, too. C++ structures are identical to C++ classes except that the access rights to a structure's functions and data members are public rather than private unless the programmer says otherwise. The reason for this is that the conceptual difference is that a structure is a collection of related data elements whereas a class is a tightly bound cohesive unit or object.
The struct keyword is short...
This section contains 714 words (approx. 3 pages at 300 words per page) |