Back to problems

Compare Two Structs / Classes for Equality

Object-Oriented Programming · Uber · Medium

Requirements Input: two instances of a struct or class. Output: whether those instances are to be treated as equivalent. Before coding, establish the equality definition: decide whether equality is value-based or identity-based, identify the relevant fields, and specify how child objects are compared. Also define the behavior for collection members, nullable members, floating-point values, and reference cycles when the language or object system supports them. Notes Because…

Checking your access…