Interface (entĂȘte) :
#include
class Fridge
{
public:
Fridge();
~Fridge();
void coolDown();
private:
class FridgeImpl;
std::unique_ptr impl_;
};
Implémentation (source) :
#include "Fridge.h"
#include
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(); }
[[https://herbsutter.com/gotw/_100/|GotW #100: Compilation Firewalls]] {{ :helloworld:design_pattern:pont:cpp:gotw_100_compilation_firewalls_difficulty_6_10_sutter_s_mill_2019-11-07_23_16_52_.html |Archive du 27/11/2011 le 07/11/2019}}
{{ :lang:cpp:smartptr:cpp_smart_pointers_ebook.pdf |C++ smart pointers fluentcpp}}