dimanche 31 juillet 2016

C++ class method reimplementation

Is there any way to tell to the compiler that not compile a method of parent class, but compiles the same method in the child class?. May be confusing my question, My app will be released in two versions: regular and demo. In demo version I want to remove/reimplement a method from the base class (the base class is from a framework), so:

class FromLibrary
{
public:
   ...
   void addProperty (Property* p) 
   {
       Some stuff with property, is used to save in files, etc...
   }
   ...
};

class MyClass : public FromLibrary
{
   #ifdef DEMO
   void addProperty (Property* p) {};
   #endif    
};

Ok, it works, but maybe a cracker can change the method address to point to "FromLibrary::addProperty"

Note: "FromLibrary" is not a static/dynamic lib, but I don't want to modify it, to keep updated without modify my own version

Aucun commentaire:

Enregistrer un commentaire