class A {
public:
virtual int test()=0;
};
class B : public A {
public:
int test(){return 10;}
};
B *b = new B();
b->test(); // would return 10;
whereas:
class A {
public:
int test(){return 0;}
};
class B : public A {
public:
int test(){return 10;}
};
B *b = new B();
b->test(); // **would return 0**;
Why does it return "0" here? This makes zero sense to me, because I assume that the (kind of overloaded) members of the derived class (B) come first! What is happening here?