mardi 13 juillet 2021

Can a class B inheriting a class A be an aggregate of it?

Can a class "ClassA", of which inherits a class "ClassB", be composed of instances of this same class "ClassB"?

With a concrete example, let's say I am making a social network, and have two classes : "Post" and "Comment"

A Comment is a subtype of Post, but a Post should be an aggregate of Comment.

Is there a classic way to manage the dependencies in this kind of context ?

Aucun commentaire:

Enregistrer un commentaire