我最近尝试了解C++ 11中的默认和删除函数,我在下面编写了示例代码.当我尝试运行时说:
错误C2065:'default':未声明的标识符
代码 :
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
struct A
{
int age;
A(int x): age(x){};
A() = default;
};
int _tmain(int argc, _TCHAR* argv[])
{
A test(10);
cout << test.age << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)