Hi guys,
So I'm trying to kinda do a Java thing with C++ which is apparently capable. I'm trying to pass a reference of a base abstract class to a different class and then make it a shared_ptr, like this:
GyroApplication is a pure abstract class.Code:SimpleApplication.cpp: mp_stateManager = std::make_shared<managers::AppStateManager>(*this); AppStateManager.cpp: AppStateManager(gyroInterface::GyroApplication& app) : mp_app(std::make_shared<gyroInterface::GyroApplication>(app) { //... }
When I run this code in Netbeans I get the following error:
"note: in instantiation of function template specialization"
But when I do this:
It works... Am I missing something? Or am I making a stupid mistake that new people tend to make?Code:AppStateManager(gyroInterface::GyroApplication& app) { gyroInterface::GyroApplication* diffApp = &app; }
Cheers Guys!
Jamie.




Reply With Quote
