Seems very complicated... perhaps virtual assignment operators and/or making sure you can't assign a class to a different type.
I think implementing a swap() might be even worse.
Seems very complicated... perhaps virtual assignment operators and/or making sure you can't assign a class to a different type.
I think implementing a swap() might be even worse.
Second, this is the kind of question you should direct at StackOverflow for the language grognards to answer. You'd likely get a full answer with quotes from the standard in like 4.7 seconds if you had posted this over there.
Lol, you are right.
The first paragraph: I agree with most of it, thanks for the advice. I dont think I can talk about the parts I dont agree with without risking a debate/opinion-exchange. ...so I wont:)
That is an interesting question, but I agree that it probably shouldn't be a concern in practice.
Virtual & multiple inheritance are designed to be used with abstract interfaces... and it doesn't make much sense to have assignment operators for interfaces.
If I have an interface IStream and derived from it I have the implementations DiskStream and NetworkStream, what does it mean when a user writes:
NetworkStream n(...);
DiskStream d(...);
d = n;// "turn my disc-reading stream into a copy of my network-reading stream" WHAT DO YOU WANT FROM ME?!
In this case, I'd probably make IStream non-copyable.
That is an interesting question, but I agree that it probably shouldn't be a concern in practice.
Virtual & multiple inheritance are designed to be used with abstract interfaces... and it doesn't make much sense to have assignment operators for interfaces.
If I have an interface IStream and derived from it I have the implementations DiskStream and NetworkStream, what does it mean when a user writes:In this case, I'd probably make IStream non-copyable.NetworkStream n(...); DiskStream d(...); d = n;// "turn my disc-reading stream into a copy of my network-reading stream" WHAT DO YOU WANT FROM ME?!