469,950 Members | 1,813 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

Error: "cannot instantiate abstract class"


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
1 2461
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.

Similar topics

2 posts views Thread by Andreas Poller | last post: by
1 post views Thread by marknewbery | last post: by
5 posts views Thread by crystalattice | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.