拷贝构造 赋值构造
来源:互联网 发布:英雄联盟17173数据库 编辑:程序博客网 时间:2024/04/30 15:05
#include <iostream>
using namespace std;
class CA
{
public:
CA(int b, char *cstr)
{
a = b;
str = new char[b];
strcpy(str, cstr);
}
CA(const CA& Other)
{
a = Other.a;
str = new char[a];
if(str!=0)
strcpy(str,Other.str);
}
CA & operator = (CA & Other)
{
if(this == &Other)
return *this;
a = Other.a;
delete []str;
str = new char[a];
strcopy(str, cstr);
return this;
}
~CA()
{
delete str;
}
private:
int a;
char *str;
};
0 0
- 构造、拷贝构造、赋值
- 拷贝构造 赋值构造
- 拷贝构造和赋值构造
- 构造&转换&拷贝&赋值
- 拷贝,赋值构造函数赋值
- 拷贝构造和拷贝赋值
- 拷贝构造与拷贝赋值
- c++构造,拷贝构造,拷贝赋值,移动构造,移动赋值
- 拷贝构造函数和赋值构造函数
- 拷贝构造函数与赋值构造函数
- 拷贝构造函数与赋值构造函数
- C++ 拷贝构造函数 赋值构造函数
- 拷贝构造函数与赋值构造函数
- 构造函数 拷贝函数 赋值构造函数
- 拷贝构造函数和赋值构造函数
- 拷贝构造函数 赋值构造函数
- 构造函数,拷贝构造函数,和赋值
- 赋值构造函数和拷贝构造函数
- TensorFlow 官方文档中文版解读之2——tf.sparse_to_dense的用法
- 判断传入的参数是否是数组
- 验证码开源类库Kaptcha
- SVM对sklearn自带手写数字数据集进行分类
- 进程间通信之文件映射
- 拷贝构造 赋值构造
- 常见的进程调度算法
- 文章标题 UVA 12299 : RMQ with Shifts(线段树+点修改)
- TensorFlow 官方文档中文版解读之1 ——tf.concat的用法的用法
- android View绘制流程与机制
- The sum problem
- Java简单的生产者与消费者实现
- 定位设备--llseek实现
- vfork不是用return返回的原因