M
ma740988
Consider the case where I'm dealing with a vendor and a customer. The
customer initiates a request to the vendor (really a multithreaded
application hence semaphores are involved - in this case the customer
gives a semaphore to vendor). The vendor upon receipt of the semaphore
will do some 'processing'. When complete will do the same. ie. give a
semaphore to the customer. So now:
class vendor;
class customer {
vendor* ven;
public:
explicit customer ( vendor& ven_) : ven(ven_)
};
class vendor {
customer *ptr_cust;
public:
explicit vendor() : ptr_cust(0)
{ ptr_cust = new customer (*this); } //<- scary object not fully
constructed
~vendor() throw() { delete ptr_cust;
ptr_cust = 0; //<- just in case }
};
For cases where both classes need to access member functions within
each other. My thougths - in this case surrounds a higher level class
- call it 'notify'. Both customer and vendor will register their
objects with notify. This is where I'm 'stuck'. Not sure how to
achive this. Source example would be helpful
Thanks in advance.
customer initiates a request to the vendor (really a multithreaded
application hence semaphores are involved - in this case the customer
gives a semaphore to vendor). The vendor upon receipt of the semaphore
will do some 'processing'. When complete will do the same. ie. give a
semaphore to the customer. So now:
class vendor;
class customer {
vendor* ven;
public:
explicit customer ( vendor& ven_) : ven(ven_)
};
class vendor {
customer *ptr_cust;
public:
explicit vendor() : ptr_cust(0)
{ ptr_cust = new customer (*this); } //<- scary object not fully
constructed
~vendor() throw() { delete ptr_cust;
ptr_cust = 0; //<- just in case }
};
For cases where both classes need to access member functions within
each other. My thougths - in this case surrounds a higher level class
- call it 'notify'. Both customer and vendor will register their
objects with notify. This is where I'm 'stuck'. Not sure how to
achive this. Source example would be helpful
Thanks in advance.