Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualATC

Posted 22 October 2012 - 08:33 PM

You are using [source] tags. You should be using [code] tags.


Hmmm... I've been clicking on the little code icon on the text editing toolbar (bottom row, farthest to the right -- to the right of the indent and alignment buttons). Is that not the right thing to be using?

You did not fully qualify the definition of the operator in the .CPP file.
It should be:

ATCFramework::Drawing::Point ATCFramework::Drawing::operator + ( const Point & p1, const Point & p2 ) {
	Point result = p1;
	return ( result += p2 );
}


I don't have to fully qualify other things, like my class/struct member methods, and I don't believe I've ever had this problem with free functions. What's the difference?

You throw an object, you catch an object. In this case you threw a logic_error object. That is derived from the exception class.
You can attempt to catch an exception object, and if so you can use what() to get your message.


So it's only going to be useful if I catch the exception? Hmmm, that kinda sucks... BTW, is the correct way to throw exception(...) or new exception(...)? I've been operating under the assumption that using throw new is like throwing type exception* which could be interpreted by the runtime as "throw unsigned long long" (or unsigned long in x86), since that's technically what a pointer is...

#1ATC

Posted 22 October 2012 - 08:32 PM

You are using [source] tags. You should be using [code] tags.


Hmmm... I've been clicking on the little code icon on the text editing toolbar (bottom row, farthest to the right -- to the right of the index and alignment buttons). Is that not the right thing to be using?

You did not fully qualify the definition of the operator in the .CPP file.
It should be:

ATCFramework::Drawing::Point ATCFramework::Drawing::operator + ( const Point & p1, const Point & p2 ) {
	Point result = p1;
	return ( result += p2 );
}


I don't have to fully qualify other things, like my class/struct member methods, and I don't believe I've ever had this problem with free functions. What's the difference?

You throw an object, you catch an object. In this case you threw a logic_error object. That is derived from the exception class.
You can attempt to catch an exception object, and if so you can use what() to get your message.


So it's only going to be useful if I catch the exception? Hmmm, that kinda sucks... BTW, is the correct way to throw exception(...) or new exception(...)? I've been operating under the assumption that using throw new is like throwing type exception* which could be interpreted by the runtime as "throw unsigned long long" (or unsigned long in x86), since that's technically what a pointer is...

PARTNERS