How to determine key members of a class

Hello
I have a question about class design, which is not clear for me.
When we write a class there are many members in that class. What is the best way to decide which members are the key members of the class? Which should be used in comparing objects with ==operator ? Should we check the equality of all the members in a class or a subset is enough for the equality and how can we decide this subset?

thanks.
There's no answer to this question. It all depends on what the type is supposed to understand as "equality". For example, a string class and a vector class have a very similar set of data members, but their definitions of equality may be very different; hell, a vector may not even have a way to check equality to another vector. Meanwhile, a string might want to check each the exact value of each character, do a case insensitive check, or perform some more complex check (e.g. whether two Unicode strings evaluate to the same string regardless of the exact code points that compose it).
Topic archived. No new replies allowed.