我有以下代碼:枚舉引用參數傳遞的不是int引用參數
typedef enum {Z,O,T} num;
bool toInt (str s,int& n);//<-if convert is possible converts s to integer ,puts the result in n and returns true,else returns false
我想使用toInt
功能和轉移作爲第二個參數,類型NUM的參數 NUM N; toInt(「2」,n); 這會導致編譯錯誤。
cannot convert parameter 2 from 'num' to 'int &'
我試圖用鑄造:toInt("2",(num)n);
但它仍是個問題 我該如何解決這個問題?
什麼是編譯器錯誤?如果你不告訴我們,我們不能幫助你。 – Pubby
@Pubby:更新 – Yakov
它仍然相當模糊,但可能是因爲您需要演員。 – Pubby