constructor problem

Hey, I'm having trouble with constructors of the derived class.

I have the following class called Event:
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "component.h" 

// Execution event in a descrete event driven simulation.
class Event{
public:
	// Construct sets time of event.
	Event (unsigned int t) : time (t) { }

	// Execute event by invoking this method.
	virtual void processEvent (bool, Component&) = 0;

	const unsigned int time;
};


The derived class is called SignalChangedEvent:
1
2
3
4
5
6
7
8
class SignalChangedEvent : public Event{
private:
    Wire *wire;
	bool value;
public:
    SignalChangedEvent(unsigned int, Wire * , bool);
    virtual void processEvent(bool, Component &);
};


The constructor of the derived class:
1
2
3
4
5
6
7
SignalChangedEvent::SignalChangedEvent(unsigned int t, Wire *  vector, bool v)
{
	time= t;
	value = v;
	vector[i]= value;

}


I have the following error when running the code:
error: no matching function for call to 'Event::Event()'
note: candidates are: Event::Event(unsigned int)

Does anyone know what is wrong with the constructor of my derived class?
The base class has no default constructor.
When an object of the derived class is created a constructor of the derived class shall call a constructor of the base class. If you will not specify explicitly in the constructor of the derived class which constructor has to be called for the base class then the compiler tries to call the default constructor of the base class. But it does not find the default constructor of the base class. So it issues an error.
Last edited on
Topic archived. No new replies allowed.