I have a class A that has a collection of objects of class B. Class A can also “inherit” (for lack of a better term) the collection of objects of class B from other instances of class A. To simulate this, instances of class A point to other instances of class A (I manage circular references).
A simplified case study may be that a person has biological children, but also “inherits” children from their spouse and former spouses.
I use class A instances with and without inherited objects in my application at runtime. That is, both “projections” of class A instances make sense to me in the context of my application in difference scenarios.
My question is: is there a sample for coding such a model or standard terminology? I don’t think that “inherit” is the right word here. I have my own ways of processing it technically and my own cumbersome terminology, but I imagine that there is a standard pattern that I can stick to, which I simply can not find.
The failed analog will test .NET class methods with and without their inherited methods, or test prototypes in Javascript, but here I am inheriting records / objects.
, , (A) , , (B) - , . (C), . , , , , , . , -, , , . , , "", , . . . , , !
, , - . , inherit above , , 100%. ?
ClassA ClassB. , ClassA ClassB, , ClassA. ClassA ClassA .
, , , . , , . , , -, , , , - .
, A B. A, A, . , , , .
, . , , , - , . - "" ( -). , .
:
The first two are similar, but your specific example clearly refers to the third. Parents do not support children, they are associated with their children, and when someone marries a family, they have new relationships (associations) created with an existing family.
So, I think the answer is no, there is no "pattern". You simply copy / transform a set of relationships from one instance to another.
Source: https://habr.com/ru/post/1727957/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1727952/how-do-i-prevent-remoteobject-from-batching-amf-messages-together&usg=ALkJrhjcfX6rH_qFpzHZvp88YjV9VvAAYgGetting started with ASP.NET using F #? - c #Question about using C # to discuss with Hadoop FileSystem - c #Unable to start an old fish on the nets - javaRemove all problematic characters in an intelligent way in C # - stringWhat views can I use in appWidget? - androidBinary files and OS - c ++Why does Azure Web Role work by default in Full Trust? - securityHow can I generate multiple Perl program files programmatically? - perlWhat is a deployment descriptor, and do I really need to take care of this when using Netbeans? - javaAll Articles