"cpluszen" <mm*****@gmail.comwrote in message
news:11**********************@t69g2000cwt.googlegr oups.com...
On 13 mar, 14:56, "Fred Zwarts" <F.Zwa...@KVI.nlwrote:
>"cpluszen" <mmza...@gmail.comwrote in
messagenews:11**********************@c51g2000cwc. googlegroups.com...
Hi,
I have developped a c++ class and I have used it in different programs
without problems.
Now, I'm modifying a c++ file developped by another person (it is a
code example about how using a library) and I'd like to include in
this code my class functionality. I get an error during execution:
#include "MyClass.h";
MyClass *p=NULL;
OthersClass *p2=NULL;
int main(void){
p2 = new OthersClass( );
p = new MyClass(myconstructorarguments);
...
}
The code compiles without problem, but during execution of line
p = new MyClass(myconstructorarguments);
I get the error: "Unhandled exception at 0x0000"
In visual C I can see that operator new returns a valid memory
position (0x00bd7188), but before any line in MyClass constructor is
reached the program crashes.
I take it you mean Visual C++ (not C), right?
Can anybody help? Thanks in advance
I guess myconstructorarguments is NULL.
Hi Fred,
in fact the constructor receives 3 arguments and none is NULL
MyClass(float,float,const char*);
Does MyClass inherit from another class? If so, perhaps the constructor of
a base class is throwing an exception.
You mention "operator new". Are you overriding that? Or, are you using
placement new?
Perhaps there is an error in the construction of the OthersClass object,
which is causing a problem later, when you create a MyClass object?
What's the *actual* call you're making, and what are the class and its
constructor definitions?
You really should avoid "fake" code like "myconstructorarguments" when
posting here, because, as you've seen, it leads people to concentrate on
things which may be entirely unrelated to the problem. What's your *real*
code, and what are the *actual* arguments you're passing? Knowing that will
help us help you much better.
-Howard