12.1. CompositionΒΆ
By now we have seen several examples of composition (the ability to
combine language features in a variety of arrangements). One of the
first examples we saw was using a function invocation as part of an
expression. Another example is the nested structure of statements: you
can put an if statement within a while loop, or within another
if statement, etc.
Having seen this pattern, and having learned about vectors and objects, you should not be surprised to learn that you can have vectors of objects. In fact, you can also have objects that contain vectors (as instance variables); you can have vectors that contain vectors; you can have objects that contain objects, and so on.
In the next two chapters we will look at some examples of these
combinations, using playing_card objects as a case study.
Which of the following statements is correct?
There are many different arrangements to combine language features. This is called __________.