As we know, delegation and inheritance can realize the same functionality.

For example,
class A : public B
{
virtual double fun();
}

and


calss A
{
double fun()
{
b_.fun();
}
private:
B b_;
}

In general, I can choose either one. However, in my program I can only use the delegation method. If the inheritance is used, it will cause weird behavior of other part of the code.

Any one has any clue what is going?

Thanks in advance.