c++ initialized specified for non-virtual method

后端 未结 3 1772
轮回少年
轮回少年 2021-02-19 23:26

I have a.h as shown below

class A
{
public:
    void doSomething()=0;
};

Then i have b.h as shown below

#include \"a.h\"

class         


        
3条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-19 23:58

    The problem is exactly what the compiler says it is.

    class A
    {
    public:
        virtual void doSomething()=0; // virtual keyword needed
    };
    

提交回复
热议问题