mercredi 30 janvier 2019

How to access non signleton class method from different class

I have a class let say.

Class A {

static A* create (); // this will give object of A (This is not single ton)

RequestToSubscribe(){
}

onResponseTosubscribe()
{
    notify()// sending update to subscribe
}

};

I have another two class B and C . which will subscribe on class A.

    Class B {

  /* creation of object of A */

     RequestToSubscribe() // call to subscribe

    notify(){
            // will receive notification from A
    }

    };


    Class C {
    /* creation of object of A */

     RequestToSubscribe() // call to subscribe

    notify(){
            // will receive notification from A
    }

    };

Now if both B and C subscribe using RequestToSubscribe(). How to send update to both B and C from A when onResponseTosubscribe is received? when both B and C are subscribe successfully.

Aucun commentaire:

Enregistrer un commentaire