我使用Boost Parameter教程爲撲克牌生成器創建了命名參數構造函數。本教程說將ArgumentPack放入基類,但我想修改卡片生成器類中的變量。我也想過這樣做:使用具有基類的朋友進行Boost參數
class CGconstructor_base {
public:
template<class ArgumentPack>
CGconstructor_base(ArgumentPack const& args);/*tutorial says to put code
in this function */
friend CardGenerator;//so it can modify the variables of CardGenerator
}
class CardGenerator:public CGconstructor_base;
這是法律還是有更好的方式來操縱CardGenerator私有變量,並使用提升參數庫? 操作系統:Windows XP專業版,編譯器:Visual C++ 2008 Express,Boost:1.39.0
謝謝!我不敢相信我搞砸了朋友的聲明。 – mmoran