[英]Error: no instance of overloaded function, in constructor (C++)
我有一個很奇怪的問題……首先,這是我班級的文件:
Show.h:
#ifndef SHOW
#define SHOW
#include <iostream>
#include <string>
#include <string.h>
class Show
{
private:
std::string m_time;
int m_serial
public:
Show(const std::string &time, const int &serial);
~Show();
};
#endif
Show.c:
#include "Show.h"
Show::Show(const std::string &time,const int &serial)
{
}
您可能會看到,當Visual Studio在Show.c文件中的第二個“ Show”單詞下划線並告訴我時,我只寫了構造函數的聲明:
“ void Show :: Show(const std :: string&time,const int&serial)
顯示:: Show()
Show :: Show(const Show&)
錯誤:沒有任何重載函數“ Show :: Show”的實例與特定類型匹配”
當我將鼠標指針停在Show.h文件中的構造函數上時,似乎該函數不存在...我以前用c ++編寫過一些類,而這是第一次發生這種情況我...請幫助:(
你忘了放;
在m_serial
字段變量之后。 我相信這就是您遇到問題的原因。 不幸的是,許多編譯器沒有給出此類問題的確切原因,因此您必須謹慎使用語法規則。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.