Why did I get the error “error C2259: … cannot instantiate abstract class”?

前端 未结 3 1126
太阳男子
太阳男子 2021-01-29 02:46

Any help is appriciated. I\'m working on a C++ factory pattern and i get this error.

1>c:\\users\\brian\\documents\\visual studio 2010\\projects\\cst276lab_3\\guitar.hpp

3条回答
  •  醉酒成梦
    2021-01-29 03:24

    class GuitarComponentFactory 
      {
         public: virtual ~GuitarComponentFactory() = 0 {}
      };
    

    In your derived ElectricGuitarComponentFactory you don't provide a destructor, hence it's still an abstract class.

提交回复
热议问题