I am a c++ n00b and I am unsure basically have looked within the right places but I am unclear about this:

include <iostream>

using namespace std;

class Enemy
{
    public:
        void sayHere()
        {
            cout<<"Here"<<endl;
        }
        virtual void attack()
        {
        }
};

class Monster: public Enemy
{

    public:
        virtual void attack()
        {
            cout<<"RAWR"<<endl;
        }

};

class Ninja: public Enemy
{

    public:
        virtual void attack()
        {

            cout<<"Hiya!"<<endl;
        }
};

int main()
{
    Ninja n;
    Monster m;
    Enemy enemies[2];
    enemies[0] = m;
    enemies[1] = n;

    for(int i = 0; i<2; i++)
    {
        enemies[i].sayHere();
        enemies[i].attack();//Will not be overriden
    }
    return 0;
}

My real question is why is not the attack() function within the Monster or Ninja class being overriden? Any help, a link, could be greatly appreciated.

Simply do:

Enemy* n = new Ninja();
Enemy* m = new Monster();

n->sayHere();
n->attack();
m->sayHere();
m->attack();

delete n;
delete m;

Which should do as you would like. You should utilize pointers for this to operate. The main reason lies in the manner dynamic binding works.

Each time a program includes a C++ virtual function declared, a v-table is built for that class. The v-table includes addresses towards the virtual functions for classes and pointers towards the functions from each one of the objects from the derived class. Whenever there's a function call designed to the c++ virtual function, the v-table can be used to solve towards the function address. This is the way the Dynamic binding happens throughout an online function call.

The concept is, the compiler stores pointers to every method in line with the memory address from the object. It requires the pointer to gain access to the table and invoke the right function pointer. Consider should you desired to write an OO version of C, how does one supply this type of mechanism as inheritance and polymorphism? It seems sensible whenever you think about it this way.

Someone said that you're moving over from JAVA. In JAVA, much of your objects are saved around the heap. It's all just implied.

JAVA's

Enemy n = new Ninja();
n.attack();

is roughly equal to

Enemy* n = new Ninja();
n->attack();

In which the . operator in JAVA is a lot more like the -> operator in c++. In the two cases, n is around the heap. Java just hides all the pointer and memory management stuff of your stuff. For this reason you could have blissful lack of knowledge of how dynamic binding works in JAVA and C#.

It has related to because you don't access your opponents through pointers:

    Ninja n;
    Monster m;

    Enemy *enemies[2];

    enemies[0] = &m;
    enemies[1] = &n;

    for (int i = 0; i < 2; i++)
    {
        enemies[i]->sayHere();
        enemies[i]->attack();
    }
    return 0;

Unless of course you access an item via a pointer or reference, virtual function calls won't work. To have it to operate, you will need to re-write your opponents array as

Enemy *enemies[2];
enemies[0] = &m;
enemies[1] = &n;

Observe that you would need to change all enemies[i]. to enemies[i]->.

Enemy enemies[2];   
enemies[0] = m;    
enemies[1] = n;

Case object slicing - only Enemy object from derived objects is going to be replicated. Virtual functions cannot play role.

The phenomenon is known as object slicing.