C++ Classes - Aggregate Classes

Aggregate Classes

An aggregate class is a class with no user-declared constructors, no private or protected non-static data members, no base classes, and no virtual functions. Such a class can be initialized with a brace-enclosed comma-separated list of initializer-clauses. The following code has the same semantics in both C and C++.

struct C { int a; double b; }; struct D { int a; double b; C c; }; // initialize an object of type C with an initializer-list C c = {1, 2.0}; // D has a sub-aggregate of type C. In such cases initializer-clauses can be nested D d = {10, 20.0, {1, 2.0}};

Read more about this topic:  C++ Classes

Famous quotes containing the words aggregate and/or classes:

    a fortress against ideas and against the
    Shuddering insidious shock of the theory-vendors
    The little sardine men crammed in a monster toy
    Who tilt their aggregate beast against our crumbling Troy.
    Louis MacNeice (1907–1963)

    Solidity, caution, integrity, efficiency. Lack of imagination, hypocrisy. These qualities characterize the middle classes in every country, but in England they are national characteristics.
    —E.M. (Edward Morgan)