So here I got a descent explanation that what actually is a virtual function and why do we really need it,
But there still remains a question in my mind that how compiler actually interpret that which definition should be used in case of multiple or hybrid inheritance. For example consider this example
class Up {
 public: 
 void func(){
      ...
    } 
};
class Middle_1 : public virtual Up {
 public:
 ...
};
class Middle_2 : public virtual Up {
 public:
 ...
};
class Down : public Middle_1, public Middle_2 {
 public:
 ...
};
In above example code, class Down is receiving two definition of class Up (i.e one from Middle_1 and another from Middle_2). However we had ensured to use the virtual tag in Middle_1 and Middle_2 class which will remove the case of ambiguity (because compiler will take only one definition) and that is where my question arises.
Actually I am having a bunch of questions,
- How will compiler select the best suited class? 
- Will the selection be similar in all conditions? 
- Didn't it contradict the fact that compiler have zero IQ? 
Thanks in advance.
 
    