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:

    The aggregate of all knowledge has not yet become culture in us. Rather it would seem as if, with the progressive scientific penetration and dissection of reality, the foundations of our thinking grow ever more precarious and unstable.
    Johan Huizinga (1872–1945)

    Is a man too strong and fierce for society, and by temper and position a bad citizen,—a morose ruffian, with a dash of the pirate in him;Mnature sends him a troop of pretty sons and daughters, who are getting along in the dame’s classes at the village school, and love and fear for them smooths his grim scowl to courtesy. Thus she contrives to intenerate the granite and the feldspar, takes the boar out and puts the lamb in, and keeps her balance true.
    Ralph Waldo Emerson (1803–1882)