[ create a new paste ] login | about

Link: http://codepad.org/zHEdiMDQ    [ raw code | output | fork ]

rizzuhjj - C++, pasted on Mar 30:
#define COMPONENT(x)
#define COMPONENT_DERIVED(x, y)

class IComponent
{
};


class ComponentBase : public IComponent
{
    COMPONENT(ComponentBase)

protected:
    static void helperComponentBase(); // COMPONENT(ComponentBase)
};


class ComponentDerived1 : public ComponentBase
{
    COMPONENT_DERIVED(ComponentDerived1, ComponentBase)
    
protected:
    static void helperComponentDerived1(); // COMPONENT(ComponentDerived1)
    
private:
    using ComponentBase::helperComponentBase; // COMPONENT_DERIVED(..., ComponentBase)
};


class ComponentDerived2 : public ComponentDerived1
{
    COMPONENT_DERIVED(ComponentDerived2, ComponentBase)
    
protected:
    static void helperComponentDerived2(); // COMPONENT(ComponentDerived2)

private:
    using ComponentBase::helperComponentBase; // COMPONENT_DERIVED(..., ComponentBase)
};

int main()
{
    return 0;
}
};


Output:
1
2
Line 14: error: 'static void ComponentBase::helperComponentBase()' is protected
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: