By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,551 Members | 2,710 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,551 IT Pros & Developers. It's quick & easy.

Can I overload throw or return?

P: n/a
It's said I can't throw an ostream object, so maybe I can overload "throw"
for my basic_ostream derived class?
Jul 22 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
ox
With the exception of a few special cases, you can "throw" any object
that you can "return".

Jul 22 '05 #2

P: n/a
Atlas wrote:
It's said I can't throw an ostream object, so maybe I can overload "throw"
for my basic_ostream derived class?

You can't throw ostreams because you can't copy them. The object
you throw must have valid copy semantics.

Jul 22 '05 #3

P: n/a
So I see. But can I overload throw or return? Does C++ support that?

"Ron Natalie" <ro*@sensor.com> ????
news:41***********************@news.newshosting.co m...
Atlas wrote:
It's said I can't throw an ostream object, so maybe I can overload "throw" for my basic_ostream derived class?

You can't throw ostreams because you can't copy them. The object
you throw must have valid copy semantics.

Jul 22 '05 #4

P: n/a
ox
What exactly do you mean by "overload"? Like operator overloading?

Jul 22 '05 #5

P: n/a
Atlas wrote:
So I see. But can I overload throw or return? Does C++ support that?


No.
Jul 22 '05 #6

P: n/a
Ron Natalie wrote:
Atlas wrote:
So I see. But can I overload throw or return? Does C++ support that?

No.


Besides, I'm not sure what you think that would accomplish.
What do you want to do?
Jul 22 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.