Very simple implementation of observer pattern in C++
Don't pass by pointer. There is no ownership associated with it (and it can be NULL and thus you need to test for that).

class Publisher {

    // Is the publisher taking ownership of the observer?
    void add_observer(Observer*);


Is your class taking ownership?

If the answer is yes (you take ownership and thus control lifespan). Then you should pass the object using a smart pointer that allows transfer of ownership.

    void add_observer(std::unique_ptr&lt;Observer&gt; obs);


If the answer is sort of. We are taking shared ownership (ie there might be other objects that are also using it). Then you pass using a smart pointer indicating shared ownership.

    void add_observer(std::shared_ptr&lt;Observer&gt; obs);


If the answer is NO then you pass a reference (as a reference can not be NULL) and also indicates that you don't have onership. 

    void add_observer(Observer&amp; obs);


If you do take ownership you need to do some work in the destructor of your publisher to make sure that you correctly relinquish ownership when the publisher dies.

If you don't have an ownership claim. This also means that the lifespan of the object may not live as longer as the publisher so you also need a way for the object to remove itself if it dies first and for the publisher to notify the observer that it has dies so it does not de-register itself from a dead object.

   void del_observer(Observer&amp; obs);