/*
*Copyright (c) 2016,烟台大学计算机学院
*All rights reserved.
*文件名称:text.cpp
*作者:陈腾
*完成日期:2016年6月09日
*版本号:v1.0
*/#include <iostream>
#include<cstring>
using namespace std;
class A
{
private:
char *a;
public:
A(char *aa)
{
a=new char[strlen(aa+1)];
strcpy(a,aa);
}
~A()
{
delete []a;
}
void output()
{
cout<<a<<endl;
}
};
int main()
{
A a("good morning,Code monkeys!");
a.output();
A b("good afternoon,codes!");
b.output();
return 0;
}
*Copyright (c) 2016,烟台大学计算机学院
*All rights reserved.
*文件名称:text.cpp
*作者:陈腾
*完成日期:2016年6月09日
*版本号:v1.0
*/#include <iostream>
#include<cstring>
using namespace std;
class A
{
private:
char *a;
public:
A(char *aa)
{
a=new char[strlen(aa+1)];
strcpy(a,aa);
}
~A()
{
delete []a;
}
void output()
{
cout<<a<<endl;
}
};
int main()
{
A a("good morning,Code monkeys!");
a.output();
A b("good afternoon,codes!");
b.output();
return 0;
}