65,186
社区成员




#include <iostream>
#include <string.h>
using namespace std;
class Internet
{
public:
Internet(char *name, char *address)
{
cout<<"load the construction function"<<endl;
strcpy(Internet::name, name);
}
Internet(Internet &temp)
{
cout<<"load COPY construction function"<<endl;
strcpy(Internet::name, temp.name);
}
~Internet()
{
cout<<"load destruction function"<<endl;
}
protected:
char name[50];
char address[30];
};
int main()
{
Internet a = Internet("中国软件开发实验室", "www.cndev-lab.com");
cout<<a.name<<endl;
return 0;
}
Internet(const Internet &temp)
{
cout<<"load COPY construction function"<<endl;
strcpy(Internet::name, temp.name);
}
#include <iostream>
#include <string.h>
using namespace std;
class Internet
{
public:
Internet(const char *name, const char *address)
{
cout<<"load the construction function"<<endl;
strcpy(Internet::name, name);
}
Internet(const Internet &temp)
{
cout<<"load COPY construction function"<<endl;
strcpy(Internet::name, temp.name);
}
~Internet()
{
cout<<"load destruction function"<<endl;
}
public:
char name[50];
char address[30];
};
int main()
{
Internet &a = Internet("中国软件开发lab", "www.cndev-lab.com");
cout<<a.name<<endl;
return 0;
}
#include <iostream>
#include <string.h>
using namespace std;
class Internet
{
public:
Internet(const char *name, const char *address)
{
cout<<"load the construction function"<<endl;
strcpy(Internet::name, name);
}
Internet(const Internet &temp)
{
cout<<"load COPY construction function"<<endl;
strcpy(Internet::name, temp.name);
}
~Internet()
{
cout<<"load destruction function"<<endl;
}
public:
char name[50];
char address[30];
};
int main()
{
Internet b("中国软件开发lab", "www.cndev-lab.com");
Internet &a = b;
cout<<a.name<<endl;
return 0;
}