Hello Guys and Gals,
Been trying to throw as follows.
throw MyException("ba d exception OMG").inputValu e("value");
I observed a strange error in my code the hypothetical MyException class has a pointer which needs to be "new" allocated. The problem was that said pointer was not initialized.
This leads me to believe that copying is going on and the copy constructor is not defined by my code. There has to be a way around the copy constructor in the first place.
I have tried
class MyException
{
char * value;
.
. //My Exception Constructor
.
MyException & inputValue(char * value_in);
{ value=value_in ; return *this}
}
and
class MyException
{
char * value;
.
. //My Exception Constructor
.
MyException inputValue(char * value_in);
{ value=value_in ; return *this}
}
What signature should I be using ? if you tell me I need to use a constructor than I might as well move the setter into the constructor.
Regards
Vain
Been trying to throw as follows.
throw MyException("ba d exception OMG").inputValu e("value");
I observed a strange error in my code the hypothetical MyException class has a pointer which needs to be "new" allocated. The problem was that said pointer was not initialized.
This leads me to believe that copying is going on and the copy constructor is not defined by my code. There has to be a way around the copy constructor in the first place.
I have tried
class MyException
{
char * value;
.
. //My Exception Constructor
.
MyException & inputValue(char * value_in);
{ value=value_in ; return *this}
}
and
class MyException
{
char * value;
.
. //My Exception Constructor
.
MyException inputValue(char * value_in);
{ value=value_in ; return *this}
}
What signature should I be using ? if you tell me I need to use a constructor than I might as well move the setter into the constructor.
Regards
Vain
Comment