| | |
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 based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings struct temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





