Message-Id: <199704151702.NAA15484@hcst.net> From: "Bryan Murphy" To: Subject: Operator == Implementation Question Date: Tue, 15 Apr 1997 10:58:13 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit I have a question about operator== for classes. What is the best method for implementing that? Currently, I have a string called name, and each object has an individual name. I just use that for comparison. operator == (const OBJECT &object) { return strcmp(name,object.name) == 0; }; however, would this work fine for me? As far as I can tell, it would, and it would probably work for all objects (not just ones with names). Or, is there a better way? I'd rather not give each object a unique name if I don't have to. operator == (const OBJECT &object) { return (this == &object); };