Subject and observer are two different entities(objects):
But with regards to your question,
the observer observes the subject or the observable
another name for subject would be observable, so they are same
Subject maintains a list of observers and all observers register at Subject.
So, whenever some event happens at subject, he notifies all observers.
Example:
Say you have a class called HTTPEngine which handles all HTTP related stuff(connection,data retreival etc).
For HTTPEngine to be reusable across different objects, It maintains a list of say IHTTPObserver.
So, any object wishing to use HTTPEngine, implements interface HTTPObserver, registers at HTTPEngine and then gets notified for events.
ex:
class HTTPObserver
{
public:
virtual void onEvent() = 0;
}
so, say a class by the name "client" wants to use HTTPENgine.
class client: public HTTPObserver
{
void onEvent(){//got the event notification}
}
Now, HTTPENgine maintains a list of observers:
class HTTPEngine
{
private:
vector<IHTTPObserver*> clients;
public:
void register(IHTTPObserver* client){clients.push_back(client);}
void notifyclients(){
for(it=vector.begin();it!=Vector.end();it++)
(*it)->notifyEvent();}
};