Open jampot5000 opened 8 years ago
This is actually good programming practice, to have an abstract class define behavior that it's subclasses can (or should) call from their own implementations:
// supersub.h
class super { public: virtual std::string foo() = 0; }; // abstract
class sub : public super { public: virtual std::string foo(); }; // concrete
// supersub.cpp
std::string super::foo() {
return "!";
}
std::string sub::foo() {
return "Hello, world" + this->super::foo();
}
However, this may not be desirable in all situations. Maybe either a global preference, or a parameter field in the inspector panel?
When a virtual function is generated from the UML it generates a pure virtual function in the header file, i.e
virtual void myFunction() = 0;
it then however also creates a method stub in the cpp file while this is not invalid c++ code, don't know if this would be common in most cases also the stub is wrong as it is also prefixed with the virtual keyword.
As a side note it would also be nice if the sub-classes could add a declaration annd stub for virtual functions in the super-class.