Hello,
so I've defined an interface for my renderer like this:
#pragma once
#include "ITexture.h"
#include "IFontWriter.h"
#include "ISprite.h"
#include <string>
class IGfx2D
{
public:
virtual void SetClipRect(const Rect* pClipRect) = 0;
virtual void SetRenderTarget(UINT id, const ITexture* pTexture) = 0;
virtual void SetCursor(int offX, int offY, std::wstring sFileName) = 0;
virtual void ClearTexture(const ITexture& texture) = 0;
virtual void Begin(void) = 0;
virtual void End(void) = 0;
};
From this I derive a class with a custom destructor, this destructor never gets called, unless I add an "virtual ~IGfx2D(void) {};" destructor to the interface. Why? This happens to all my (pure) virtual classes without a custom destructor. I assume the compiler (VS 2012) does automatically add a standard destructor if I didn't define one myself. But I though an interface should not have an destructor. Does an interface in c++ really need an virtual destructor or is it some compiler-setting or define I need to do?