Mooophy/Cpp-Primer

Typo in exercise 15.34 / 15.36

RedactedContributor opened this issue · 0 comments

README for exercise 15.34:

For the expression built in Figure 15.3 (p. 638):
Query q = Query("fiery") & Query("bird") | Query("wind");

(a) List the constructors executed in processing that expression.

5. Query::Query(std::shared_ptr<Query_base> query) 2times
8. Query::Query(std::shared_ptr<Query_base> query) 2times

claims that the Query::Query(std::shared_ptr<Query_base> query) constructor is called multiple times for the expression, but the answer for exercise 15.36 two sections down contradicts it.

Query q = Query("fiery") & Query("bird") | Query("wind");
[ ... ]
AndQuery::AndQuery()
Query::Query(std::shared_ptr<Query_base> query)
OrQuery::OrQuery
Query::Query(std::shared_ptr<Query_base> query)
[ ... ]

I did the exercise myself and the output was similar to the above.