Technology Quote by Eric Freeman
““Two objects are equal only if the variables containing the object references point to the same object.””
About This Quote
Source Book: "Head First Design Patterns" by Eric Freeman, 2004
Objects are considered equal only when they reference the exact same memory location.
In simple terms: Equality requires identical object references.
Use reference equality checks.
Themes
Mood
Type
When to use this quote
- debugging code
- designing APIs
- teaching OOP
Key Concepts
Questions to Reflect On
- When should you use value equality?
- What problems arise from reference checks?
Sometimes logical equality is needed instead of reference equality.