Skip to content

Instantly share code, notes, and snippets.

@c9s
Created July 21, 2014 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c9s/0c3e679ea81118147989 to your computer and use it in GitHub Desktop.
Save c9s/0c3e679ea81118147989 to your computer and use it in GitHub Desktop.
/*
* test.cc
* Copyright (C) 2014 c9s <c9s@c9smba.local>
*
* Distributed under terms of the MIT license.
*/
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
class Foo {
public:
Foo() {
cout << "constructor" << endl;
}
Foo(const Foo& f) {
cout << "copy-constructor" << endl;
}
~Foo() {
cout << "destructor" << endl;
}
Foo& operator =(const Foo& a) {
cout << "operator =" << endl;
return *this;
}
};
void bar(Foo foo) {
}
int main() {
Foo a;
bar(a);
Foo b;
b = a;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment