Tuesday, July 21, 2009

[AIT09] Connector

This question is from Thein Tun Aung

  1. What are the main variables of class Connector?
  2. Which ones are the pointer?
  3. Where do they point to? Is the object they point to an abstract object? If so, how?
  4. How do we fit the connector to a class composition framework?

2 comments:

Unknown said...

(Hasanain/106000)
1)The main variables of class Connector are target_ and drop_
2)Class Connector contains two pointers to NsObjects: target_ and drop_
3)Connector has a private pointer target_ to its downstream object. Therefore, it forwards a packet to its downstream object by invoking target_->recv(p,h). While drop_ is the pointer to the packet dropping object.
Yes, class Connector contains two pointers to abstract object (i.e., class NsObject), it can be regarded as an abstract user class for class composition.
4)Class Connector derives from the abstract class NsObject. It overrides the pure virtual function recv(p,h), by simply invoking function send(p,h).

Unknown said...

Class Connector contains
two pointers target_ and drop_ to NsObjects.

NsObject* target_;
NsObject* drop_;

target_ is the pointer to the connecting downstream object, while drop_ is the pointer to the packet dropping object.

yes the pointers points to abstract object (i.e., class NsObject),

it can be regarded as an abstract user class for class composition.