vendredi 13 avril 2018

Observer Pattern: Why should Subject be Abstract?

I'm learning C++ in school and when talking about the Observer pattern, my prof says that the Subject should be Abstract at all costs. If there are no obvious PV methods make the destructor PV. They also said that you still need to implement the base class destructor to avoid problems. So 2 follow up questions:

  1. Why do we need to implement base class destructor? What problems would not doing so cause?
  2. Why is it so important Subject base class be abstract? I understand why Observer base class needs to be abstract, but why subject?

Aucun commentaire:

Enregistrer un commentaire