#include<string>
using namespace std;
struct temp
{
string s;
};
int main()
{
const string p="aaa";
temp *q;
q=(struct temp*)malloc(sizeof(struct temp));
q->s=p;
}
??????????????????????3????ж?
???????????new????????棬malloc??????y?????
???????????string????????????????????檔
#include<string>
using namespace std;
struct temp
{
string s;
};
int main()
{
const string p="aaa";
temp *q;
//q=(struct temp*)malloc(sizeof(struct temp));
q = new temp;
q->s=p;
????C++????????????????????????д???????????????
????malloc????????檔
????new?????????滹????ù????????