Using virtual inheritance in “final” classes in unfinished class hierarchies

Is there any harm, or is it considered a poor design, to proactively get practically classes in the incomplete hierarchy of classes that are currently “below” (i.e., the most derived)? Is there a good reason why I want to wait until there really is a need for virtual inheritance (i.e. when someone decides to expand the hierarchy, and this leads to a diamond)?

+3
source share
2 answers

I would avoid virtual inheritance until actually necessary. When you use virtual inheritance, you infiltrate some of the abstractions that you build on your class, and, in particular, how you initialize your base class by forcing the virtual database to be called to the most derived type.

+3
source

This adds complexity to a system that does not need it.

, . -, , . , , , .

KISS - . Rube Goldberg.

+2

All Articles