← Back to archive

Stdle #57 · overload · 2026-08-02

What does this C++ snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

#include <iostream>
#include <string>
void f(bool) { std::cout << "bool\n"; }
void f(const std::string&) { std::cout << "string\n"; }
int main() {
f("hello");
}
Overload
4 attempts left

Answer & explanation