how do i represent this in aggregation C# code
P1 and P2 as classes and then use aggregation to assign A, A’ instances to them.
apprecite a reply thanks
how do i represent this in aggregation C# code
P1 and P2 as classes and then use aggregation to assign A, A’ instances to them.
apprecite a reply thanks
hey how do i represent this
ppareicae a reply
thnks
You need to explain a lot more what you are trying to do.
P1 component has A and B components
so how do i represent it in aggregation
hope thi helps
appreciate a reply
thnaks
Represent what in aggregation? Does P1 have aggregates of A and B? Do you need an aggregate of P1?
so the description is as "You could represent P1 and P2 as classes if you like too – and then use aggregation to assign A, A’ instances to them"
Many ways to do it
class P {
A[] myArray;
public P(int A') {
myArray = new A[A'];
for (int i = 0; i < A'; i++) {
myArray[i] = new A();
}
}
}
class P1 {
List<A> myList = new List<A>();
public P1(int A') {
for (int i = 0; i < A'; i++) {
myList.Add(new A());
}
}
}
Note that A' is not a valid variable name, I just used it to match your description. myArray and myList are aggregates of type A.
hey momerath
in a situation like
if P1 is primary and p2 is seconday os this the way i represent
class P1 {
List<trackManager> A = new List<trackManager>();
List<trackManager> B = new List<trackManager>();
public P1(int tm) {
}
}
}
class P2 {
List<trackManager> A' = new List<trackManager>();
List<trackManager> B' = new List<trackManager>();
public P2(int tm) {
}
}
}
appreciate a reply
thanks
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.