Interface (entête) :
#include <memory> class Fridge { public: Fridge(); ~Fridge(); void coolDown(); private: class FridgeImpl; std::unique_ptr<FridgeImpl> impl_; };
Implémentation (source) :
#include "Fridge.h" #include <iostream> class Fridge::FridgeImpl { public: void coolDown() { std::cout << "coucou\n"; } private: int engine_; }; Fridge::Fridge() : impl_(new FridgeImpl()) {} Fridge::~Fridge() = default; void Fridge::coolDown() { impl_->coolDown(); }
GotW #100: Compilation Firewalls Archive du 27/11/2011 le 07/11/2019