Problem :
I encounter an error when compiling "parameter of abstract class type "type" is not allowed", as described in http://software.intel.com/en-us/articles/cdiag646/. Does anybody know why and how to fix it?
Environment :
Windows, Linux, Mac and Intel C++ compiler.
Resolution :
The problem is you are trying to declare a parameter that has the type of an abstract base class.
Abstract classes are designed to be only interfaces to real classes because they have one or
more pure virtual functions, i.e.:
class abstract {
virtual void foo() = 0; // pure virtual function since it is declared with = 0
};
void foo(abstract); // not allowed since the class is abstract
The workaround would be to only use pointers or references to the abstract class as parameters, or change the type to a non-abstract class that is derived from the abstract class or change the class so it is no longer abstract, i.e. define the virtual functions instead of declaring them pure virtual.