std::enable_shared_from_this; public vs private
I was playing around for a bit using the shared_ptr's and enable_shared_from_this, while I run into something I don't really understand. In my first attempt I constructed something like this: class shared_test : std::enable_shared_from_this<shared_test> { public: void print(bool recursive) { if (recursive) { shared_from_this()->print(false); } std::cout << "printing" << std::endl; } }; Please note that this class is extending std::enable_shared_from_this privately. This apparently makes a lot of difference because executing a something like this: int main() { auto t(std::make_shared<shared