【发布时间】:2010-11-26 22:48:58
【问题描述】:
#include <iostream>
#include <conio.h>
using namespace std;
class Base
{
int a;
public:
Base(const Base & b)
{
cout<<"inside constructor"<<endl;
}
};
int main()
{
Base b1;
getch();
return 0;
}
这给出了一个错误。调用 `Base::Base()' 没有匹配的函数 为什么?
【问题讨论】:
-
这不能解决您的问题,但理想情况下,您的复制构造函数应该采用 const 引用。
标签: c++