Given the following code:
#pragma once class B { public: B(void) { } ~B(void) { } };
I know I can also write this:
#pragma once class B { public: B() { } ~B() { } };
What is the purpose of having void in the first example? Is it some type of practice that states the constructor take zero parameters?
The two are same, at least in C++. In C, providing an empty pair of parentheses typically means an unspecified parameter list (as opposed to an empty parameter list). C++ does not have this problem.
How can a correct answer get downvoted so many times? Yet another SO bug?