March 2020
Intermediate to advanced
534 pages
14h 15m
English
We can also use this method in order to construct classes when retrofitting extensibility to a class structure constructed through a switch statement.
These constructors are usually written as follows:
ConVMSVehicleServiceStatusBase instance;switch (_status){ case ConVMSVehicleServiceStatus::None: instance = new ConVMSVehicleServiceStatus_None(); break; case ConVMSVehicleServiceStatus::Confirmed: instance = new ConVMSVehicleServiceStatus_Confirmed(); break; // etc. default: throw error("<Status not implemented error>");}
In this case, the parameter class would be written as follows:
class ConVMSVehicleServiceStatusConstructResponseParameters{ public boolean delegateWashandled; public ConVMSVehicleServiceStatusBase instance; ...Read now
Unlock full access