[ create a new paste ] login | about

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

C++, pasted on May 9:
#include <iostream>

class hoge
{
    int *p;

public:
    hoge() : p(0)
    {
        p = new int(0);
    }

    ~hoge()
    {
        delete p;
    }

    void set(int x) const
    {
        *p = x;
    }

    int get(void) const
    {
        return *p;
    }
};

int main(void)
{
    const hoge h;

    h.set(10);

    std::cout << h.get() << std::endl;

    return 0;
}


Output:
1
10


Create a new paste based on this one


Comments: