实现一个简单的string类
user.h
//!时间:2017年9月11日(周一)上午
//!内容:类与动态内存分配
//!备注:Test类实现简单的string功能
//!最后修改时间:NULL
//user.cpp
#define _CRTDBG_MAP_ALLOC//内存溢出检测
#include
#include "Test.h"
using namespace std;
_CrtMemState s1, s2;//作为参数
int main()
{
//如果程序从开始加flag这一句,leaks就能自动调用而不写
//适合用在多个退出点的情况
//_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
//_CrtMemCheckpoint(&s1);//s1,s2之间可以具体定位
//_CrtMemCheckpoint(&s2);
{
Test one = "this is test!";//构造
Test two;//默认构造
two = one;//赋值运算符Test
two = "test two.";//赋值运算符char*
Test three(one);//拷贝构造
cin >> three;
cout
关注
打赏