By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,760 Members | 1,644 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,760 IT Pros & Developers. It's quick & easy.

Error: "cannot instantiate abstract class"

P: n/a

I have the following problem:

I have a class deriving from ICustomTypeDescriptor:

public __gc class TPropertyBag : public ICustomTypeDescriptor

private: ...

virtual String* GetClassName(){return
TypeDescriptor::GetClassName(this,true);} //[LINE 27]


When I try to instantiate it, I get the following compiler errors:

------ Build started: Project: QiCadApp, Configuration: Debug Win32



d:\apps\TPropertyBag.h(27) : error C2039: 'GetClassNameA' : is not a
member of 'System::ComponentModel::TypeDescriptor'
TCadInspector.cpp(0) : see declaration of

d:\apps\TPropertyBag.h(27) : error C2660:
'TPropertyBag::GetClassNameA' : function does not take 2 arguments

TCadInspector.cpp(11) : error C2259: 'TPropertyBag' : cannot
instantiate abstract class
due to following members:
'System::String __gc *TPropertyBag::GetClassName(void)' : pure
virtual function was not defined
TCadInspector.cpp(0) : see declaration of

Build log was saved at "file://d:\apps\Debug\BuildLog.htm"
QiCadApp - 3 error(s), 0 warning(s)


I donīt understand anything what the compiler tells me, because:

1. I have the Symbol "GetClassNameA" anywhere in my project
2. As you can see, I overrided the virtual function "virtual String*
GetClassName()" correctly

I can remove the error 2039 and 2660 when I change the line

virtual String* GetClassName(){return
virtual String* GetClassName(){return NULL;}

The interesting thing is, that in another project it works without any
problems. I included the unit with this code to this new project and
got these errors. Maybe there is something wrong with the project
settings of this new project but I don`t know where to search.

I hope that anyone can help me,


Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Andreas Poller wrote:

I have the following problem:

You've #included <windows.h> which defines a macro GetClassName.

A simple

#undef GetClassName after the #include should do the trick.


Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.