0

How to code cleanly on observer pattern

Refer code below: I have a question on the said code. Query 1 : How can I have a cleaner or better code for below lines: yt1.AddObserver(&h1); yt1.AddObserver(&h2); yt1.AddObserver(&h3); h1.setSubject(&yt1); h2.setSubject(&yt1); h3.setSubject(&yt1); Query 2: How can I have channel name and video name into human class update method? https://sololearn.com/compiler-playground/cpPj4yuEO2Fl/?ref=app

10th Nov 2024, 1:34 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
9 ответов