void cWSSAnvil::LoadBoatFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) { std::auto_ptr<cBoat> Boat(new cBoat(0, 0, 0)); if (!LoadEntityBaseFromNBT(*Boat.get(), a_NBT, a_TagIdx)) { return; } a_Entities.push_back(Boat.release()); }
TEST(StrictInterfaces, Boat) { { auto boat0 = Boat(std::make_shared<YamahaEngine>(), 6.7f); auto boat1 = boat0; // ... and does not realize that the oil amount applies to both boats boat1.set_length(8.56f); boat1.get_engine()->set_oil_amount(3.4f); } { auto&& boat0 = BoatNoncopyable{std::make_shared<YamahaEngine>(), 6.7f}; // [auto&& is needed in current version of MSVC] // Below code won't compile, the second programmer will have to find another solution compliant with the limitations of the Boat /* auto boat1 = boat0; */ } }