Hack Forums
[C] A Challenge for the bored C++'ers (Simple) Reference Counter - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C] A Challenge for the bored C++'ers (Simple) Reference Counter (/showthread.php?tid=6082740)



A Challenge for the bored C++'ers (Simple) Reference Counter - saltycracker - May 29, 2020

A Challenge for the bored C++'ers (Simple) Reference Counter.

Here's a challenge that should push the C++ rookies.

Start with this simple class MyInt and make a (simple) reference counter for it.

Code
class MyInt {

    public:

        MyInt():value(0) {}
        
    private:

        int value;

};

If this is a simple exercise for you, then make the MyInt class into a node for a linked list and make the (simple) reference counter for that.

Have fun.