Iterator not treating item as its actual class

So, I'm working with a private dev kit for a multitouch device, and I've run into a bit of a snag. I'm using their iterator, which iterates through child Widgets. Here's how I'm using it:

1
2
3
4
5
6
7
8
9
10
11
    for (ChildIterator it = this->getpairControl()->childBegin(); it != this->getpairControl()->childEnd(); ++it)
    {
        if (this->location() != it->location())
        {
            if (((it->location().x+22.5) < (this->location().x+90) & (it->location().x+22.5) > (this->location().x-45)) & ((it->location().y-22.5) < (this->location().y+45) & (it->location().y-22.5) > (this->location().y-90)))
            {
                this->boolPaired = true;
                it->boolPaired = true; // <-- LOL ERROR
            }
        }
    }


Ignoring the inefficency of my code at the moment (I'm experimenting), both this and the item it are a custom class (based off of Widget) with a variable named boolPaired which is, of course, a boolean. I need to set that boolean. However, when I run the code, it says
../Blocks/oneunit.cpp:32: error: 'class MultiWidgets::Widget' has no member named 'boolPaired'

So it seems like it's casting the widget as the base class, Widget, instead of the derived class, oneUnit. Is there some way to get around this?
Should you be calling a method instead of directly attempting to access boolPaired?
I should be, but this was the one member I hadn't made a method for. But when I did make a method for doing this, I still got
../Blocks/oneunit.cpp:32: error: 'class MultiWidgets::Widget' has no member named 'setPaired'
Have you tried casting it to the derived class yourself?
HI ,
can you provide more details about .. ChildIterator
Topic archived. No new replies allowed.