Puzzle 2 | String Theory |
| #include <iostream> |
| #include <string> |
| |
| void serialize(const void*) { std::cout << "const void*"; } |
| |
| void serialize(const std::string&) { std::cout << "const string&"; } |
| |
| int main() |
| { |
| serialize("hello world"); |
| } |
Guess the Output | |
---|---|
Try to guess what the output is before moving to the next page. |
The program displays the following output:
| const void* |
Discussion
Why does passing ...
Get C++ Brain Teasers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.