Mooophy / Cpp-Primer

C++ Primer 5 answers
Creative Commons Zero v1.0 Universal
8.06k stars 3k forks source link

Typo in exercise 15.34 / 15.36 #803

Open RedactedContributor opened 3 years ago

RedactedContributor commented 3 years ago

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.