I want a pure virtual parent class to call a child implementation of a function like so:
class parent
{
public:
void Read() { //read stuff }
virtual vo
You need to wrap in inside an object that calls the virtual method after the object is fully constructed:
class parent
{
public:
void Read() { /*read stuff*/ }
virtual void Process() = 0;
parent()
{
Read();
}
};
class child: public parent
{
public:
virtual void Process() { /*process stuff*/ }
child() : parent() { }
};
template
class Processor
{
public:
Processor()
:processorObj() // Pass on any args here
{
processorObj.Process();
}
private:
T processorObj;
};
int main()
{
Processor c;
}