tags:

views:

338

answers:

2

What's wrong with TextLayoutTransition? Can function pointers not be declared virtual?

LCDWrapper.h:23: error: function definition does not declare parameters

Here's the class.

class LCDInterface {
    public:

    // Slots
    virtual void TextSetSpecialChars() = 0;
    virtual void LayoutChangeBefore() = 0;
    virtual void LayoutChangeAfter() = 0;
    virtual void TextSpecialCharChanged(unsigned int i) = 0;
    virtual void ChangeLayout() = 0;
    virtual void (*TextLayoutTransition)(Generic<LCDText> *v){}; // line 23
    virtual void TransitionFinished() = 0;
};

Edit: Slightly related, and related to Qt, can function pointers be declared as slots/signals?

+2  A: 

No, you cant.. it doesnt make sense to put virtual on a function pointer. You cant override a variable.

Andrew Keith
+3  A: 

Function pointers are data. Data members can't be virtual. And they can't have a "body" defined through {} as in your example. What were you trying to do with this?

AndreyT