comparing 2 objects withing a class

In my CS class, I have to make a class Rectangle2D and this is one of the required functions: A function contains(Rectangle2D &r) that returns TRUE if rectangle r is inside this rectangle2D. I have all of the rest of it done but I am having trouble with this part. This is what I have so far:

bool Rectangle2D::contains(const Rectangle2D &r) const
{
bool temp = false;
if((this->x + width / 2) >= ((*r).getX() + (*r).getWidth() / 2) && (this->x - width / 2) <= ((*r).getX() - (*r).getWidth() / 2))
if((this->y + height / 2) >= ((*r).getY() + (*r).getHeight() / 2) && (this->y - height / 2) <= ((*r).getY() - (*r).getHeight() / 2))
temp = true;
return temp;
}

I get an error though, error C2511: 'bool Rectangle2D::contains(const Rectangle2D &) const' : overloaded member function not found in 'Rectangle2D'.

Any ideas? Thanks!
Nevermind, haha. I figured it out:) in my header file I forgot an &.

bool contains(Rectangle2D);

Then I had to remove all of those pointers because I got a bunch of illegal indirection errors.

Now to see if the function works:)
Topic archived. No new replies allowed.