I'm programming a class that implements the observable pattern (not the interface) and I'm thinking about whether or not the copy constructor should also copy the listeners.
On the one hand the copy constructor should create an instance that is as close as possible to the original instance so that it can be swapped out in the display context.
On the other hand this would assume the listeners can cope with that kind of thing.
Any thoughts? Are there any best practices?
Don't copy. The listeners are not aware of the new object and are not expecting to receive messages related to it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With