0

The Visual C++ "Add class" wizard creates code where constructors and destructors contain the void keyword in the parameter list.

For example:

class MyClass
{
public:
  MyClass(void);
  ~MyClass(void); 
};

instead of:

class MyClass
{
public:
  MyClass();
  ~MyClass(); 
};

Is this a microsoftism is it actually the correct way to do in c++?

Jabberwocky
  • 45,262
  • 17
  • 54
  • 100

1 Answers1

2

It's a Microsoftism, as a stylistic holdover from C (in which it does have a distinct meaning)

I've seen a few people use this style in C++ code, but very rarely from anything but ignorance. In my experience, the rest have switched over when informed.

Of course, in C++, there's no functional difference whatsoever.

Community
  • 1
  • 1
Lightness Races in Orbit
  • 369,052
  • 73
  • 620
  • 1,021