| | |
error C2259: 'ClassName' : cannot instantiate abstract class
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Jul 2008
Posts: 46
Reputation:
Solved Threads: 0
HI
I have a class className which is an abstract class. I am attaching the definition in the code snipet below.
when I am writing the line I am getting an error
error C2259: 'className' : cannot instantiate abstract class
From this error I have understood that we cannot create an instance of an abstract class
But when I make the object of the class i.e.
className obj.
and try to access the public function initState().
I am getting an error
"object reference is not set"
How to resolve this problem
Regards
Karan
I have a class className which is an abstract class. I am attaching the definition in the code snipet below.
when I am writing the line I am getting an error
error C2259: 'className' : cannot instantiate abstract class
From this error I have understood that we cannot create an instance of an abstract class
But when I make the object of the class i.e.
className obj.
and try to access the public function initState().
I am getting an error
"object reference is not set"
How to resolve this problem
C++ Syntax (Toggle Plain Text)
class ClassName : public Class2, public Class3{ virtual ~ClassName{} public: virtual void initState (); protected: virtual void clearState (); }
Regards
Karan
![]() |
Other Threads in the C++ Forum
- Previous Thread: C++ card game war
- Next Thread: Reading from text file into array
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion count data delete deploy desktop directshow dll download dynamic encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node number output parameter pointer problem program programming project proxy python random read recursion recursive return string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





