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

后端 未结 4 698
我寻月下人不归
我寻月下人不归 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:39

    I just wanted to add that when you use void after the parameters like function():void it is used to indicate that the function does not return a value.

提交回复
热议问题