C++构造函数问题
#include<iostream>usingnamespacestd;classBase{public:intk;Base(intn):k(n){}};classBig...
#include <iostream>
using namespace std;
class Base {
public:
int k;
Base(int n):k(n) { }
};
class Big {
public:
int v; Base b;
Big(int n)
{
b=Base(n);
v=n;
}
};
int main() {
Big a1(5);
return 0;
}
为什么提示no matching function for call to ‘Base::Base' 展开
using namespace std;
class Base {
public:
int k;
Base(int n):k(n) { }
};
class Big {
public:
int v; Base b;
Big(int n)
{
b=Base(n);
v=n;
}
};
int main() {
Big a1(5);
return 0;
}
为什么提示no matching function for call to ‘Base::Base' 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询