3
votes
The dilemma of implementing virtual inheritance
Virtual inheritance as used by some C++ implementations only makes sense under fairly specific constraints:
Classes have a fixed object layout that is known at compile-time.
An instance can be ...
2
votes
When wouldn't I want to allow polymorphic deletion in C++?
Let us precisely look at what you wrote:
If I don't know how users will derive from my interface or how they will want to delete objects of the derived class, why wouldn't I always make the ...
1
vote
When wouldn't I want to allow polymorphic deletion in C++?
The C++ core guidelines indeed recommends
A base class destructor should be either public and virtual, or protected and non-virtual
The reason is that
derived classes may need their own destructor, ...
1
vote
When wouldn't I want to allow polymorphic deletion in C++?
Unlike other methods, the class of an instance changes while you are running a chain of constructors or destructors. So if a virtual method is called from destructor or constructor it might not be the ...
1
vote
Accepted
Using virtual inheritance for an interface system based on abstract classes
Your design challenge
On one side, you have an abstraction IShape, and more specialized abstractions like IShapeConvex, IShapeHullConvex. On the other side, you have implementations of these ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
virtual-inheritance × 5c++ × 3
inheritance × 2
object-oriented × 1
programming-practices × 1
interfaces × 1
language-design × 1
class-design × 1
abstract-class × 1
paradigms × 1
multiple-inheritance × 1
idioms × 1