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
  • 48,281
  • 17
  • 65
  • 115

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
  • 378,754
  • 76
  • 643
  • 1,055