Equals method implemented in the class Is this a proper way to implement an equality check?  In Equals method, I am relying on    bad_cast exception to know if the objects are of the same class or not.   

Is there any other way to implement Equals() in C++?

class Shape
{
public:
    virtual ~Shape() = 0;
    bool operator==(const Shape&amp; s) 
    {
        return Equals(s);
    }

    virtual bool Equals(const Shape&amp; s) = 0;        
};



class Circle : public Shape
{


    bool Equals(const Shape&amp; c) override
    {
        try
        {
            const Circle&amp; other = dynamic_cast&lt;const Circle&amp;&gt;(c);
                      // condition to check equality.
        }
        catch(std::bad_cast&amp;)
        {
            return false;
        }
        catch(...)
        {
            throw;
        }
    }
};

class Square : public Shape   
{
    bool Equals(const Shape&amp; s)  override
    {       
        try
        {
            const Square&amp; other = dynamic_cast&lt;const Square&amp;&gt;(s);
                      // condition to check equality.
        }
        catch(std::bad_cast&amp;)
        {
            return false;
        }
        catch(...)
        {
            throw;
        }       
    }
};

typedef std::shared_ptr&lt;Shape&gt; ShapePtr;
typedef std::vector&lt;ShapePtr&gt; Shapes;

Shapes LoadShapes()
{
    Shapes shapes;
    shapes.push_back(std::make_shared&lt;Circle&gt;(42));
    shapes.push_back(std::make_shared&lt;Circle&gt;(52));
    shapes.push_back(std::make_shared&lt;Circle&gt;(62));
    shapes.push_back(std::make_shared&lt;Square&gt;(10));
    return shapes;
}

int main()
{
    auto circle = std::make_shared&lt;Circle&gt;(42);
    auto shapes = LoadShapes();
    for ( auto&amp; shape : shapes)
    {
        if ( *shape == *circle)
        {
            std::cout &lt;&lt; *shape &lt;&lt; "\n";
        }
    }
}    


EDIT

Made the operator== as non-virtual method.
Sorry to bump this one year old question, but there is something inherently wrong in your equality check if you ever extend to more than one level of inheritance.

Consider a class Foo deriving from Circle, assuming the same implementation (with changed types of course).

Foo foo;
Circle circle;
Shape &amp; shapeFoo = foo;
Shape &amp; shapeCircle = circle;

// these two should behave the same, but they don't:
std::cout &lt;&lt; (shapeFoo == shapeCircle) &lt;&lt; std::endl;
std::cout &lt;&lt; (shapeCircle == shapeFoo) &lt;&lt; std::endl;


Why does this fail?

shapeFoo == shapeCircle will call shapeFoo.Equals(shapeCircle) which will be dispatched on the implementation of Equals in class Foo. There the dynamic_cast&lt;Foo const *&gt; will fail, correctly returning false.

However shapeCircle == shapeFoo will call shapeCircle.Equals(shapeFoo) which will be dispatched on the implementation of Equals in class Circle. There the dynamic_cast&lt;Circle *&gt; will succeed (as Foo is a descendant of Circle). Then the method will compare only the attributes of Circle, probably returning true.