What is the meaning of having void in the constructor definition?

后端 未结 4 640
我寻月下人不归
我寻月下人不归 2021-02-13 02:28

Given the following code:

#pragma once

class B
{
public:

    B(void)
    {
    }

    ~B(void)
    {
    }
};

I know I can also write this:

4条回答
  •  一整个雨季
    2021-02-13 02:52

    afaik if you pass void into the constructor or any function as the argument it means that the function dosnt take any argument so example a and b are equal. but i am not sure if any of them change the function signature in any way or make it run faster etc.

提交回复
热议问题