What is ment by overlap? I am guessing thats a triangle fits into square or circle, or square fits into a circle?

You can have a protected variable say m_value in shape and have constructors for each class. Constructor will set the value to say 1 for triangle, 2 for square, 3 for circle. You will also need a getter in shape to be able to access the m_value.

You would also have an public bool intersect(Shape s1, Shape s2) in Shape class.

This function would look like somthing like this:

Code:
bool intersect(Shape s1, Shape s2) {
        return s1.getValue() > s2.getValue;
}
Thats it, again this is assuming I understand the meaning of overlap.