w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Diamond inheritance twice derived - constructor params different - base cannot be found with virtual inheritance specified

You don't have diamond inheritance, there's no shared base classes here ( derived2 -> derived1 -> base -> ( object -> iobject ), ibase ), nowhere in this chain is there any duplicates. Hence, you don't need virtual inheritance, so just drop public virtual across the board. I realize this is a contrived example and doesn't match your real usage, but in my experience it's EXTREMELY rare that you actually need multiple inheritance with virtual calls, which is something which you generally should stay away from if at all possible ( object size, call overhead and general nastiness with how pointers behave ).





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.