#include <iostream>
#include <random>
using namespace std;
class Foo {
public:
Foo();
~Foo();
Foo(const Foo&);
Foo & operator=(const Foo&);
};
Foo::Foo() {
cout << "Foo ctor" << endl;
}
Foo::~Foo() {
cout << "Foo dtor" << endl;
}
Foo::Foo(const Foo& t) {
cout << "Foo copy ctor" << endl;
}
Foo& Foo::operator=(const Foo& t) {
cout << "Foo asign op" << endl;
return const_cast<Foo&>(t);
}
const Foo ft(Foo t) {
return t;
}
void main() {
const Foo f; //Foo ctor
Foo F; //Foo ctor
Foo r = ft(f); //Foo copy ctor
//Foo copy ctor
//Foo dtor
Foo g(f); //Foo copy ctor
Foo h = f; //Foo copy ctor
F = f; //Foo asign op
getchar();
}