This is a Fundamental type question, forgive me for being so amateurish.
Case 1:
Employee _emp1 = new Employee();
Employee _emp2 = _emp1;
_emp1.Equals(_emp2) ==> RETURNS a True !!
Case2:
Employee _emp1 = new Employee();
Employee _emp2 = new Employee();
_emp1.Equals(_emp2) ==> RETURNS a False !!
Could you explain me the above Comparison method and reason interms of Memory-Mapping and allocation perspective ?
Everytime you have
new Employee()you have new memory allocated in heap and stack.means _emp1 is value in memory pointing to heap say 1212.
Now you have second statement
So again new value _emp2 say 1414 in heap.
That’s why _emp1.Equals(_emp2) returns false here.
when you say
You are assigning the same values in both.