ImageButton problem: No match for operator ==


#1

Hey guys i have followed all the tutorials and watch some code which generally uses::

[code]
void TestComponent::buttonClicked (Button* buttonClicked) {

if (buttonClicked == someOtherButton ) {

}

}[/code]

But when i use it with ImageButton which inherits from Button i get:

Where and how should i overload the operator, should i make another class that inherits from ImageButton, or what :?:

Thanks in Advance.


#2

You’re probably missing the * in front of the declaration of Button.
operator == exist for any pointer to any pointer of the same type.

Typically:

if (&imageButton == buttonClicked) // Good if imageButton declared as ImageButton imageButton
if (imageButton == buttonClicked) // Good if imageButton declared as ImageButton * imageButton

#3

You asked this question both in the #JUCE IRC channel and on StackOverflow and I answered you in both places. Why is it necessary to continually re-ask the question?