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:

    We cannot think of a legitimate argument why ... whites and blacks need be affected by the knowledge that an aggregate difference in measured intelligence is genetic instead of environmental.... Given a chance, each clan ... will encounter the world with confidence in its own worth and, most importantly, will be unconcerned about comparing its accomplishments line-by-line with those of any other clan. This is wise ethnocentricism.
    Richard Herrnstein (1930–1994)

    Between richer and poorer classes in a free country a mutually respecting antagonism is much healthier than pity on the one hand and dependence on the other, as is, perhaps, the next best thing to fraternal feeling.
    Charles Horton Cooley (1864–1929)