各位好,我想问一下,这段程序,可以在vs2010上运行,但是不能在vs2019上运行,为什么?
#include <iostream>
using namespace std;
class String
{
public:
String() { p = NULL; }
String(char* str);
void display();
private:
char* p;
};
String::String(char* str)
{
p = str;
}
void String::display()
{
cout << p;
}
int main()
{
String string1("Hello"), string2("Book");
string1.display();
cout << endl;
string2.display();
return 0;
}