Implementation of releasable object. If a class can be released/destroyed it can be derived from this class. As a result it will have Release()
method which can be used to destroy class instance. This is preferred way of destroying classes accessed via their interfaces. When working with interfaces using destructor directly is forbidden.
You can find more information in comments below. Overrided methods can be found in corresponding base interface.
class CReleasable :public virtual IReleasable
{
protected:
virtual void BeforeRelease(); // Called before releasing object
public:
int AddRef() override;
bool Release(const bool force = false) override;
CReleasable(IReleasableListener *listener = nullptr);
virtual ~CReleasable() = default;
};
Namespace: | nitisa |
Include: | Nitisa/Core/Releasable.h |