Foo f = Foo(); // no matching function for call to 'Foo::Foo(Foo)' … huh?

后端 未结 10 3291
小鲜肉
小鲜肉 2021-02-19 20:13
class Foo
{
public:
    explicit Foo() {}
    explicit Foo(Foo&) {}
};

Foo d = Foo();

error: no matching function for call to \

10条回答
  •  轮回少年
    2021-02-19 20:51

    class Foo
    {
    public:
        explicit Foo() {}
        explicit Foo(const Foo&) {}
    };
    
    Foo d = Foo()
    

提交回复
热议问题