String Theory
Test your C++ programming skills by solving the given puzzle about function overloading.
We'll cover the following
Puzzle code
Carefully read the code given below:
#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");}
Your task: Guess the output
Try to guess the output of the above code. Attempt the following quiz to assess your understanding.
Q
What is the expected output of the above code?
A)
hello world
B)
const void*
C)
const string&
D)
Compilation error
Let’s discuss the code and output together in the next lesson.
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.