KLA interview question

Algorithm for reference counting in c++