TORC Robotics interview question

I was asked to implement a smart-pointer class with automatic garbage collection and reference counting.