DesignPattern🔗
Classes🔗
Name | |
---|---|
class | DesignPattern::Creation This pattern can be used if you write an abstraction where you have to throw an exception in the constructor when you for instance would like to manage a resource and the constructor was unable to acquire that resource. In this case you inherit from [Creation]() and your class has three more static factory methods - create , placementCreate and verify . create forwards all arguments to the underlying class constructor and if the construction was successful an expected containing the type is returned, otherwise an error value which describes the error. Additionally, this class is providing two protected member variables m_isInitialized and m_errorValue . The user always has to set m_isInitialized to true when the object construction was successful otherwise one sets it to false and write the corresponding error cause in the provided m_errorValue variable which is then returned to the user. |
Updated on 18 December 2023 at 13:02:34 CET