July 2017
Intermediate to advanced
244 pages
6h 33m
English
A request for Dispatcher always derives from the pure virtual AbstractRequest class:
#pragma once#ifndef ABSTRACT_REQUEST_H#define ABSTRACT_REQUEST_Hclass AbstractRequest { // public: virtual void setValue(int value) = 0; virtual void process() = 0; virtual void finish() = 0;};#endif
This AbstractRequest class defines an API with three functions, which a deriving class always has to implement. Out of these, the process() and finish() functions are the most generic and likely to be used in any practical implementation. The setValue() function is specific to this demonstration implementation, and would likely be adapted or extended to fit a real-life scenario.
The advantage of using an abstract class as the basis for a request ...
Read now
Unlock full access