Design and implement a simplified reference-counted smart pointer class (SharedPtr<T>) from scratch in modern C++. Your implementation must enforce RAII: acquire a heap object in the constructor and release it in the destructor when the last reference disappears. Support copy semantics (copy constructor and copy assignment) to share ownership and increment the reference count, move semantics (move constructor and move assignment) to transfer ownership without adjusting the count, and provide operators * and -> for transparent access. Do not use std::shared_ptr or any other STL smart-pointer utilities; manage the reference-count control block yourself with ordinary new/delete. Make the class thread-safe for reference-count updates (you may use std::atomic). Demonstrate that circular references are still possible with your SharedPtr and show how introducing a companion WeakPtr<T> (non-owning, weak references) would break such cycles. In the interview you will be asked to walk through the full implementation, explain how the control block is laid out, and justify every line of code with respect to exception safety and the C++ rule of five.