Implementing the observer pattern for a stock exchange scenario
Make immutable class members const

If you have a member of a class that is set once at construction time, but will never change, then make it const. For example, in Stock:

class Stock {
  const std::string name;
  ...
  public:
  Stock(..., std::string stock_name, ...): name(stock_name) {
    ...
  }


And once it is const, you can safely make name public and remove get_name().

Avoid circular references

Your stock exchanges contain stocks, but stocks also refer to stock exchanges. This circular reference is unnecessary and might give you problems; for example you had to add forward references to class Stock_Observer and class Stock in stock_exchange.hpp. Conceptually, a stock is not tied to a specific stock exchange, so just remove the member variable Stock::se.

Of course, the problem is now how to notify observers when the stock price changes. One way to handle that is to allow one to set a callback function in a Stock, for example:

#include &lt;functional&gt;

class Stock {
  std::function&lt;void(Stock &amp;)&gt; price_changed_callback;
  double price;
  ...
  public:
  void set_price_changed_callback(std::function&lt;void(Stock &amp;)&gt; callback) {
    price_changed_callback = callback;
  }

  void set_price(double p) {
    price = p;
    if (price_changed_callback)
      price_changed_callback(*this);
  }
  ...
}


Then the stock exchange calls set_price_changed_callback() when it registers the stock, and sets it to something like its notify_observers() function.
If you want to have a Stock be part of multiple exchanges, then you'd better look for a library that handles more complex callback registration for you, like libsigc++.

Another option would be to move set_price() to the stock exchange itself.

Think carefully about ownership

In your code, stock exchanges have pointers to stocks, and stocks have a pointer to a stock exchange. But what if a stock goes out of scope before a stock exchange, or vice versa? It's not a problem in your simple main(), but once your code grows the chance you will make a mistake will increase. It's best to use the right tools to control ownership.

One possibility is to use shared_ptr&lt;&gt;. Make it so you can only create a shared_ptr to a Stock:

class Stock {
  private:
  Stock() { ... }

  public:
  static std::shared_ptr&lt;Stock&gt; make_stock(args) {
    return std::make_shared&lt;Stock&gt;(args);
  }
}


And have Stock_Exchange keep a map of shared_ptrs:

class Stock_Exchange {
  std::unordered_map&lt;std::string, std::shared_ptr&lt;Stock&gt;&gt; registered_stocks;
  ...
}


Alternatively, if you'd only ever have stocks associated with a single exchange, you could have Stock_Exchange take direct ownership:

class Stock_Exchange {
  std::unordered_map&lt;std::string, Stock&gt; registered_stocks;
  ...
  public:
  register_stock(std::string name, double price) {
    register_stocks.emplace(std::make_pair(name, Stock(name, price));
  }
}


Of course, if you go that route there is little point in having a class Stock anymore.

Use references when iterating over a container where possible

In this part of your code:

for(auto o : stock_observers[stock_name])
{
    o-&gt;notify(stock_name);
}


You are actually making a copy of each observer. It is almost always better to use a reference when iterating through a container:

for(auto &amp;o : stock_observers[stock_name])
{
    o-&gt;notify(stock_name);
}