[ create a new paste ] login | about

Link: http://codepad.org/Kh7O7WC5    [ raw code | output | fork ]

C++, pasted on Oct 6:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>

class MyInt {
private:
    int x;
public:
    MyInt(int const y): x( y )
    { std::cout << "Constructor 1 called." << std::endl; }
    MyInt(MyInt const &y): x( y.x )
    { std::cout << "Constructor 2 called." << std::endl; }
};

int main(void)
{
    MyInt i = 1;

    return 0;
}


Output:
1
2
Constructor 1 called.
Constructor 2 called.


Create a new paste based on this one


Comments: