1

以下のサンプルでは、​​各 TradingStrategy(1-N).cpp ファイル内でローカル オーバーライドを作成したいと考えています。これをC ++で実装する最も簡単な/標準的な方法を教えてもらえますか?

ありがとう、マイク

// TradingSide.h file
class BuySide: public CTradingSide{
public:
BuySide(CBMTTradingStrategy *p_Strategy, bool  p_buySellSide, u32 p_spotInstIndex, u32 p_futInstIndex );
~BuySide();
virtual void    onQuoteBuyExit( u32 p_instIndex );
virtual void    onQuoteBuyEntry( u32 p_instIndex );
virtual void    onFIXBuyEntry( u32 p_orderIndex, bmt_eng_events_t p_orderEvent );
virtual void    onFIXBuyExit( u32 p_orderIndex, bmt_eng_events_t p_orderEvent );
virtual inline bool isBuyEntryCriteriaSatisfied( bmt_price_t &p_spotCash, u32 &p_buySpotQty  );
};

class SellSide: public CTradingSide{
public:
SellSide(CBMTTradingStrategy *p_Strategy, bool  p_buySellSide, u32 p_spotInstIndex, u32 p_futInstIndex );
~SellSide();
virtual void    onQuoteSellExit( u32 p_instIndex );
virtual void    onQuoteSellEntry( u32 p_instIndex );
virtual void    onFIXSellEntry( u32 p_orderIndex, bmt_eng_events_t p_orderEvent );
virtual void    onFIXSellExit( u32 p_orderIndex, bmt_eng_events_t p_orderEvent );
virtual inline bool isSellEntryCriteriaSatisfied( bmt_price_t &p_spotCash, u32 &p_sellSpotQty  );
};

// TradingStrategy1.h file
class Trading1Class: public ParentClass{
...
SellSide    *mySellSide;
BuySide *myBuySide;
}
// TradingStrategy1.cpp file
Trading1Class::BuySide::onQuoteBuyExit( u32 p_instIndex )
{
...
}

// TradingStrategy2.h file
class Trading2Class: public ParentClass{
...
SellSide    *mySellSide;
BuySide *myBuySide;
}
// TradingStrategy2.cpp file
Trading1Class::BuySide::onQuoteBuyExit( u32 p_instIndex )
{
...
}
4

1 に答える 1