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 think of religion as the symbolic expression of our highest moral ideals; we think of magic as a crude aggregate of superstitions. Religious belief seems to become mere superstitious credulity if we admit any relationship with magic. On the other hand our anthropological and ethnographical material makes it extremely difficult to separate the two fields.
    Ernst Cassirer (1874–1945)

    The most powerful lessons about ethics and morality do not come from school discussions or classes in character building. They come from family life where people treat one another with respect, consideration, and love.
    Neil Kurshan (20th century)