hybrid inheritance c++