第一次写c++程序,运行出错,崩溃!

#include<iostream>
#define _CRT_SECURE_NO_WARNINGS
using namespace std;
class Internet
{
public:
    char *name;
    char *url;
public:
    Internet(const char *name,const char *url)//!!!
    {
        Internet::name = new char[strlen(name) + 1];
        Internet::url = new char[strlen(url) + 1];
        if (name)
        {
            strcpy(Internet::name, name);
        }
        if (url)
        {
            strcpy(Internet::url, url);
        }
    }
    Internet(Internet &temp)
    {
        Internet::name = new char[strlen(name) + 1];
        Internet::url = new char[strlen(url) + 1];
        if (name)
        {
            strcpy(Internet::name, name);
        }
        if (url)
        {
            strcpy(Internet::url, url);
        }
    }
    ~Internet()
    {
        delete[]name;
        delete[]url;
        cout << "析构函数!" << endl;
        cin.get();
    }
    Internet& operator =(Internet &temp)
    {
        delete[]this->name;
        delete[]this->url;
        this->name = new char[strlen(name) + 1];
        this->url = new char[strlen(url) + 1];
        if (this->name)
        {
            strcpy(this->name, temp.name);
        }
        if (this->url)
        {
            strcpy(this->url, temp.url);
        }
        return *this;
    }
};
int main()
{
    Internet a("试试","www.shsihi.com");
    Internet b = a;//拷贝构造函数
    cout << b.name << endl << b.url << endl;
    Internet c("康康", "wwww.kuangkuang.com");
    b = c;//重载
    cout << b.name << endl << b.url << endl;
    system("pause");
    return 0;
}

能否请各位帮忙给我检查一下这个怎么运行不了?

这个错误太多了,不建议成员构造函数的参数跟成员同名。拷贝构造函数和=号重载,字符串成员应该用参数的成员赋值,你是自己给自己赋值。

修改如下,供参考:

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
using namespace std;
class Internet
{
public:
    char* name;
    char* url;
public:
    Internet(const char* name, const char* url)//!!!
    {
        this->name = new char[strlen(name) + 1];
        this->url  = new char[strlen(url) + 1];
        if (name)
        {
            strcpy(this->name, name);
        }
        if (url)
        {
            strcpy(this->url, url);
        }
    }
    Internet(Internet& temp)
    {
        this->name = new char[strlen(temp.name) + 1];
        this->url  = new char[strlen(temp.url) + 1];
        if (temp.name)
        {
            strcpy(this->name, temp.name);
        }
        if (temp.url)
        {
            strcpy(this->url, temp.url);
        }
    }
    ~Internet()
    {
        delete[]name;
        delete[]url;
        cout << "析构函数!" <<endl;
        //cin.get();
    }
    Internet& operator =(Internet& temp)
    {
        delete[]this->name;
        delete[]this->url;
        this->name = new char[strlen(temp.name) + 1];
        this->url  = new char[strlen(temp.url) + 1];
        if (temp.name)
        {
            strcpy(this->name, temp.name);
        }
        if (temp.url)
        {
            strcpy(this->url, temp.url);
        }
        return *this;
    }
};
int main()
{
    Internet a("试试", "www.shsihi.com");
    Internet b = a;//拷贝构造函数
    cout << b.name << endl << b.url << endl;
    Internet c("康康", "wwww.kuangkuang.com");
    b = c;//重载
    cout << b.name << endl << b.url << endl;
    //system("pause");
    return 0;
}