Get the default constructor back via the new keyword default - C++ Class

C++ examples for Class:Constructor

Description

Get the default constructor back via the new keyword default

Demo Code

#include <string>
using namespace std;
class Employee//from www  .ja v  a2s  .c om
{
public:
  Employee(const char *pName) { name = pName; }
  Employee() = default;

  string name;
};

int main(int argcs, char* pArgs[])
{
  Employee noName;
  return 0;
}

Related Tutorials