class Component;
class Wire {
private:
Component& component;
int inputBitNum;
bool value;
public:
Wire(Component& c, int i) : component(c), inputBitNum(i), value(false) { }
void process();
void setValue(bool v) {value = v;}
};
class Event
{
public:
// Construct sets time of event.
Event (unsignedint t) : time (t) { }
// Execute event by invoking this method.
virtualvoid processEvent () = 0;
constunsignedint time;
};
};
My question is how should the constructor of wire be called in this SignalChangedEvent class. I have already initialized the object *wire in the initializer list of the SignalChangedEvent constructor.
1 2 3 4 5 6 7 8 9
class SignalChangedEvent : public Event
{
private:
Wire *wire;
bool value;
public:
SignalChangedEvent(): wire(new Wire);
virtualvoid processEvent();