Skip to content

Instantly share code, notes, and snippets.

@xunkai55
Last active October 21, 2015 03:39
Show Gist options
  • Save xunkai55/b4de8e9435185a338e52 to your computer and use it in GitHub Desktop.
Save xunkai55/b4de8e9435185a338e52 to your computer and use it in GitHub Desktop.
default copy constructor
#include <iostream>
using namespace std;
struct B {
int a, b;
B(): a(0), b(0) {}
B(const B &other) = default;
};
int main() {
// your code goes here
B b;
b.a = 5;
b.b = 3;
B c(b);
B d;
cout << c.a << " " << c.b << endl;
cout << d.a << " " << d.b << endl;
d = c;
cout << d.a << " " << d.b << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment