#include <iostream>
struct X {
X() { std::cout << "a"; }
X(const X &x) { std::cout << "b"; }
const X &operator=(const X &x) {
std::cout << "c";
return *this;
}
};
int main() {
X x;
X y(x);
X z = y;
z = x;
}
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