#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;
class stu
{
public:
stu();
~stu();
void getp(char **p)
{
*p = new char[100];
}
public:
char *name;
};
stu::stu()
{
getp(&name);
strcpy(name, "Hello word");
}
stu::~stu()
{
}
int main()
{
stu a;
cout << a.name;
return 0;
}
#include<iostream>
using namespace std;
class stu
{
public:
stu();
~stu();
void getp(char **p)
{
*p = new char[100];
}
public:
char *name;
};
stu::stu()
{
getp(&name);
strcpy(name, "Hello word");
}
stu::~stu()
{
}
int main()
{
stu a;
cout << a.name;
return 0;
}