コード例 #1
0
    void Method()
    {
        CSharedBetweenSome sharedSomeInstances = new CSharedBetweenSome();
        CChildClass        cc = new CChildClass(sharedSomeInstances);
        COtherChild        oc = new COtherChild(sharedSomeInstances);

        //Set the name property of childclass
        cc.sharedAllValue        = "same name for everyone"; // ALL  instance of ChildClass will have this name, ALL instances BOtherChild will be able to acess it
        sharedSomeInstances.name = "sane name for cc and oc instances";
    }
コード例 #2
0
 public COtherChild(CSharedBetweenSome sharedSomeInstance)
 {
     this.sharedSomeInstance = sharedSomeInstance;
 }
コード例 #3
0
 public CChildClass(CSharedBetweenSome sharedSomeInstance)
 {
     this.sharedSomeInstance = sharedSomeInstance;
 }