I have the following interface:struct IFilter{    virtual enterClass(ClassData&, int recursiveLevel) = 0;    virtual enterStructure(ClassData&, int recursiveLevel) = 0;    virtual enterVariable(ClassData&, int recursiveLevel) = 0;    virtual enterFunction(ClassData&, int recursiveLevel) = 0;};And here is an example of an implementation:struct ReadOnlyFilter: public IFilter{    virtual enterClass(ClassData& classData, int recursiveLevel)    {        if(recursiveLevel==0 || classData->isReadondOnly())        {            this.out << Class  << classData->name() << \n{;        }    }So items can contain classes, structs, variables and functions. A class or struct can contain items as children and grandchildren and so on. The class ReadOnlyFilter is used by a function which will loop recursively over all of the children and grandchildren etc of an item. The recursiveLevel is incremented as we go deeper and deeper, like this:Class c (recursiveLevel=0){    Variable v1 (recursiveLevel=1)    Class cChild (recursiveLevel=1)    {       Class cGrandChild (recursiveLevel=2)All my implementations have one thing in common: they should always write to this.out if the recursiveLevel is zero. This is why I have if(recursiveLevel==0 || in my code. This results in ifs everywhere in my code.To solve this, I was thinking of doing something like this instead and was wondering if you think this is a good solution:(I'm using C++98 and Boost)struct IFilter{    virtual enterClass(ClassData&, int recursiveLevel) = 0;    virtual enterStructure(ClassData&, int recursiveLevel) = 0;    virtual enterVariable(ClassData&, int recursiveLevel) = 0;    virtual enterFunction(ClassData&, int recursiveLevel) = 0;    virtual enterChildClass(ClassData&, int recursiveLevel) = 0;    virtual enterChildStructure(ClassData&, int recursiveLevel) = 0;    virtual enterChildVariable(ClassData&, int recursiveLevel) = 0;    virtual enterChildFunction(ClassData&, int recursiveLevel) = 0;};struct BaseFilter: public IStyler{    virtual enterClass(ClassData& classData, int recursiveLevel)    {        out << Class  << classData->name() << \n{;    }struct ReadOnlyFilter: public BaseFilter{    virtual enterChildClass(ClassData& classData, int recursiveLevel)    {        if(classData->isReadondOnly())        {            enterClass(classData, recursiveLevel);        }    }
Parent implementation different to child implementation
c++;inheritance