该程序应该在课堂上展示建设性和破坏性功能的功能
this program is supposed to show the function of constructive and destructive function in class
不幸的是,我收到了此错误:没有与参数列表匹配的重载函数
strcpy_s
实例。我不知道这是什么剂量?? 你介意帮帮我吗?
//......................................................
#include<iostream>
#include<conio.h>
using namespace std;
class one
{
char *s;
public:
one()
{
cout << "constructiven";
}
void f(char *str)
{
s = new char[strlen(str) + 1];
strcpy_s(s, str);
}
void f1()
{
cout << s << "n";
}
~one()
{
cout << "destructive";
}
};
one f2()
{
char s[80];
one x;
cout << "enter a string: n";
gets_s(s);
x.f(s);
return x;
}
int main()
{
one a;
a = f2();
a.f1();
_getch();
return 0;
}
//................................................
这意味着编译器找不到该函数,那是因为您没有#include <cstring>
.
相关文章:
- 在执行其他功能的同时播放动画(LED矩阵和Arduino/ESP8266)
- 多态性和功能结合
- 功能可用性
- C++ - 多态性:不能使用功能
- 继承多态性功能调用
- 在多态性中重新定义功能(虚拟),具有不同数量的参数
- 朋友功能可访问性问题
- 关于Lambdas,转换以功能指针以及私人数据成员的可见性
- CTAGS不适用于多态性功能
- 模板等效性或模板功能等效性
- 使用自定义比较功能设置相等性
- 相等性测试功能
- 提升侵入性unordered_set静态成员功能返回错误的尺寸类型
- 在OCAML中,抽象的价格有多大(即多态性功能)
- C 中的功能功能和数组
- C 成员功能多态性问题
- 呼叫过程中的自我删除性std ::功能
- #包括在功能体内部或降低其可见性
- 具有非成员功能的std::载体的多态性
- 多态性与功能过载