[ create a new paste ] login | about

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

Isoparametric - C++, pasted on Sep 25:
class Uncopyable {
protected:
    Uncopyable() {}
    ~ Uncopyable() {}
private:
    Uncopyable(const Uncopyable&);
    Uncopyable& operator=(const Uncopyable&);
};

class Hoge : private Uncopyable {
public:
    Hoge(int value) : value_(value) {}
private:
    int value_;
};

int main(int argc, char* argv[])
{
    Hoge hoge1(1);
    Hoge hoge2(hoge1);    
    hoge1 = hoge2;
    return 0;
}


Output:
1
2
3
t.cpp: In copy constructor 'Hoge::Hoge(const Hoge&)':
Line 6: error: 'Uncopyable::Uncopyable(const Uncopyable&)' is private
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: