P
Philipp
Hello
I don't exactly understand why there are no static virtual functions. I
would have liked something like this:
class Base{
static virtual std::string getName(){
return "Base";
}
}
class Derived: public Base{
static std::string getName(){
return "Derived";
}
}
so I can compare with what some pointer gives me. eg.
Base* pointer = getSomeBasePointer();
if( pointer->getName == Derived::getName() ){
doSomething();
}
Could someone please explain why this is so?
Thanks Phil
I don't exactly understand why there are no static virtual functions. I
would have liked something like this:
class Base{
static virtual std::string getName(){
return "Base";
}
}
class Derived: public Base{
static std::string getName(){
return "Derived";
}
}
so I can compare with what some pointer gives me. eg.
Base* pointer = getSomeBasePointer();
if( pointer->getName == Derived::getName() ){
doSomething();
}
Could someone please explain why this is so?
Thanks Phil