[ create a new paste ] login | about

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

C++, pasted on Sep 12:
#include <iostream>

using namespace std;

class Foo{
public:
        int value;
        Foo(int value){ this->value = value; }
        int operator && (int value) { return this->value && value; }
};

// p(value)  valueを表示し、そのまま返す。
Foo& p(Foo& value){
        cout << "Foo: " << value.value << endl;
        return value;
}
int p(int value){
        cout << "int: " << value << endl;
        return value;
}

int main(){
        Foo zero(0);
        int t;

        t = p(zero) && p(2);
        cout << t << endl;
}


Output:
1
2
3
int: 2
Foo: 0
0


Create a new paste based on this one


Comments: