Skip to content

Instantly share code, notes, and snippets.

@lasagnaphil
Created April 27, 2016 05:54
Show Gist options
  • Save lasagnaphil/6b4f340c5a6c39d52a8304b162869d15 to your computer and use it in GitHub Desktop.
Save lasagnaphil/6b4f340c5a6c39d52a8304b162869d15 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
class A
{
public:
A(int = 1);
A(const A&);
void print();
void printX() {
cout << X << endl;
}
private:
int X;
const int Y;
};
A::A(int value) : X(value), Y(7) {}
A::A(const A& a) : X(3), Y(2) {}
void A::print()
{
cout << X << endl;
cout << Y << endl;
}
int main() {
A t(12);
A s = t;
t.print();
s.print();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment