Код: Выделить всё
template
struct Base
{
static T foo()
{
return T::create();
}
virtual void blabla();
};
struct Derived : public Base
{
static Derived create()
{
return Derived();
}
void blabla(){};
};
struct Derived2 : public Base
{
static Derived2 create()
{
return Derived2();
}
void blabla(){};
};
Думаю, я не могу объявить такой тип указателя без типа шаблона? Пытался поиграться с этими строками, но безуспешно:
Код: Выделить всё
typedef Base (*voidFunc)();Код: Выделить всё
Base (*func)() = &Base::foo;Код: Выделить всё
Base (*func)() = &Derived::create;Подробнее здесь: https://stackoverflow.com/questions/791 ... rived-type
Мобильная версия