a simple smart pointer implementation (Taken from : http://www.codeproject.com/Articles/15351/Implementing-a-simple-smart-pointer-in-c)