Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Post Undeleted by Dr. Mumtaz Ali Shah
Post Deleted by Dr. Mumtaz Ali Shah
added 410 characters in body; deleted 561 characters in body
Source Link
Dr. Mumtaz Ali Shah
  • 12.3k
  • 5
  • 35
  • 40

You ask "Whats the mistake I make ?" . Your following line is where I think you went wrong:

What I mean to say is that the subject Class must know the observer object to add him to the list of objects to notify.

ONLY THE INTERFACE resides with the subject class. The subject class ONLY deals with the interface. Anybody can come along and implement the interface.

You ask "Whats the mistake I make ?" . Your following line is where I think you went wrong:

What I mean to say is that the subject Class must know the observer object to add him to the list of objects to notify.

ONLY THE INTERFACE resides with the subject class. The subject class ONLY deals with the interface. Anybody can come along and implement the interface.

You ask "Whats the mistake I make ?" . Your following line is where I think you went wrong:

What I mean to say is that the subject Class must know the observer object to add him to the list of objects to notify.

Source Link
Dr. Mumtaz Ali Shah
  • 12.3k
  • 5
  • 35
  • 40

You ask "Whats the mistake I make ?" . Your following line is where I think you went wrong:

What I mean to say is that the subject Class must know the observer object to add him to the list of objects to notify.

ONLY THE INTERFACE resides with the subject class. The subject class ONLY deals with the interface. Anybody can come along and implement the interface.