- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
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?
Thanks,
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?
Thanks,
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please paste some code snippet here. thanks!
Jennifer
Jennifer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.:
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 abstractclass 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.
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I created a knowledge base article using content of this issue. The article is available at http://software.intel.com/en-us/articles/abstract-class-type-not-allowed-as-a-type-for-parameter/.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank You, the information is very helpful.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page