I understand that this sounds asymmetrical, but the answer is no. An abstract class cannot be created and therefore cannot be used as a member of another class.
Asymmetry is obvious because you can use an abstract class as a base, and even a basic subobject of an object must be created; but in this case the operation is allowed, and just the resulting class automatically becomes abstract.
However, the logical reason is that in this last case, you can extract a specific class from this new abstract class, while in the first case, the C ++ language syntax will have nothing to do with replacing the included object type with the class object obtained from this type.
In a sense, the subobject type of the database / a class can subsequently be changed in the inheritance hierarchy, while the subobject type of the regular element is fixed.
Of course, you can use a pointer or a link to an abstract class in the object, because in this case the real type of the object will be concrete and will be known only at runtime.
source share