Код: Выделить всё
struct Base
{
virtual void Call(void*) const = 0;
};
//template
//struct Derived :
//! in practice, those are templated classes specifying the type; but it makes no difference on the result so has been simplified here
struct DerivedStatic :
public Base
{
private:
void Call(void* pData) const override final
{
CallTyped(*reinterpret_cast(pData));
}
virtual void CallTyped(int data) const = 0;
};
struct UserStatic final :
public DerivedStatic
{
private:
void CallTyped(int data) const override
{
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79870736/are-compilers-allowed-to-merge-nested-virtual-calls-inside-a-final-class[/url]