1
我不知道類似的問題之前問過,但我不能知道如何尋找它,重複的標記是值得歡迎的一個功能,如果你給我提供一個鏈接:)整數輸入給需要const引用
,所以我請問:
#include <iostream>
class H
{
public:
H(int x = 0)
{
std::cout << "constructor";
}
};
void func1(const H &a1)
{
}
int main()
{
func1(15);
return 0;
}
你能解釋一下這裏發生了什麼嗎?爲什麼它接受int值作爲const引用,調用構造函數等?
謝謝。