Make a class both Observer and Observable

Hi,

Sorry If it's a basic question, but I would like to know if there is any problem if I do something like this:

public MyClassextends Observableimplements Observer{

}

MyClass is observed by another class and observes another one too. Any problem with that ?

Thanks !

[459 byte] By [aboaventuraa] at [2007-10-2 8:09:03]
# 1
I'm not particularly familiar with Java's Observer and Observable but as far as the observer pattern goes I don't see anything wrong with an observer being a subject as well. Just be sure you don't introduce anything cyclical.
kablaira at 2007-7-16 22:04:15 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
Nothing wrong with that. Just don't allow an instance to Observe itself.%
duffymoa at 2007-7-16 22:04:15 > top of Java-index,Other Topics,Patterns & OO Design...