#include <iostream>
struct X {
X() { std::cout << "1"; }
X(const X &) { std::cout << "3"; }
~X() { std::cout << "2"; }
void f() { std::cout << "4"; }
} object;
int main() {
X(object);
object.f();
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter