WallarooC++依賴注入庫
Wallaroo 是一個C++的依賴注入庫,您可以使用字符串來創(chuàng)建對象,你也可以從配置文件中加載“對象圖”。
示例代碼:
#include "wallaroo/catalog.h" using namespace wallaroo; ... // load classes in shared libraries: Plugin::Load( "car" + Plugin::Suffix() ); // Plugin::Suffix() expands to .dll or .so according to the OS ... Catalog catalog; // this is the container of your objects // populate the catalog with some objects: catalog.Create( "ferrari_f430", "Car" ); catalog.Create( "maserati_granturismo", "Car" );
評論
圖片
表情
