In C++ is not possible to declare a static virtual function, neither cast a non-static function to a C style function pointer.
Now, I have a plain ol\' C SDK that us
I still can see a use for static virtual methods, here an example:
class File
{
static virtual std::string extension() {return "";}
}
class ExecutableFile : public File
{
// static because every executable has same extension
static virtual std::string extension() {return ".exe";}
}
std::string extension = "";
// needing static
extension = ExecutableFile::extension();
// not needing static nor virtual
ExecutableFile exeFile;
extension = exeFile.extension();
// needing virtual
File* pFile = &exeFile;
extension = pFile->extension();