相关疑难解决方法(0)

构造函数在头文件中具有默认参数

我有一个像这样的cpp文件:

#include Foo.h;
Foo::Foo(int a, int b=0)
{
    this->x = a;
    this->y = b;
}
Run Code Online (Sandbox Code Playgroud)

我如何在Foo.h中引用它?

c++ constructor header

27
推荐指数
4
解决办法
3万
查看次数

标签 统计

c++ ×1

constructor ×1

header ×1