2016-12-01 59 views
0

早上傢伙,我正在運行此代碼,但我得到的錯誤:「預期」{'之前TEMPLATE1「,在」簡單初始化TEMPLATE1inate「行,即使我不'不明白爲什麼這是必需的。預期不合格的錯誤'{'之前TEMPLATE1

class MIXIM_API TEMPLATE1 : public cObject 
    { 
    public: 
     /** @brief Constant with all values set to 0. */ 
     static const TEMPLATE1 ZERO; 

public: 
    BasicSafetyMessage BSM; 

private: 
    void copy(const TEMPLATE1& other) { BSM = other.BSM; } 

public: 
    /** @brief Default constructor. */ 
    TEMPLATE1() 
     : BSM {} 

    /** @brief Initializes a TEMPLATE1inate. */ 
    TEMPLATE1(BasicSafetyMessage bsm) 
      : BSM(bsm) {} 

    /** @brief Initializes TEMPLATE1inate from other TEMPLATE1inate. */ 
    TEMPLATE1(const TEMPLATE1& other) 
     : cObject(other) { copy(other); } 

    /** @brief Returns a string with the value of the TEMPLATE1inate. */ 
    std::string info() const; 

}; 


inline std::ostream& operator<<(std::ostream& os, const TEMPLATE1& TEMPLATE1) 
{ 
    return os << "(" << TEMPLATE1.BSM << ")"; 
} 

inline std::string TEMPLATE1::info() const { 
    std::stringstream os; 
    os << *this; 
    return os.str(); 
} 

回答

1
TEMPLATE1() 
    : BSM {} 

我不知道這是什麼應該做的。您錯過了一組()或一組{}或其他我無法猜到的東西。

這是一個空的默認構造函數,使用BSM的默認構造函數:

TEMPLATE1() 
{ 
} 

我想你想要的。

+0

你是對的,我傻了,錯過了一套BSM構造函數。非常感謝 – FMA

相關問題