So I have two classes Class A and Class B.
export class A {
aName: string
aBs: B[];
}
export class B {
bID: number
bName: string
}
Class A contains a list of objects of B. bID is unique. No two B objects can have the same bID. Every object of class B (with a unique bID) can belong to only 1 object of class A. What is the best way to instantiate B with a knowledge of which object of A it belongs to? Should I create another class AB which combines the two? But how exactly?
Aucun commentaire:
Enregistrer un commentaire