/*Illustrates aliasing (and potential bugs it can bring about).
Lecture Material for 1/21*/

public class EmployeeMain2 {
  public static void main(String [] args) {
 
    //create two employees
    Employee emp1 = new Employee("Sam", 12, new Address("Forest Ave.", 1215) );
   
    System.out.println("Created emp1: ");
    emp1.printEmpInfo();
    System.out.println("+++++++++++++++++++++++++++");
    //emp2.printEmpInfo();
    //System.out.println("+++++++++++++++++++++++++++");
    
    //let's create a third employee as follows
    Employee emp3 = new Employee(emp1);  
    
    System.out.println("Created emp3 (identical to emp1): ");
    emp3.printEmpInfo();
    System.out.println("+++++++++++++++++++++++++++");
    
    
    //now change the name and street address of emp1
    emp1.setName("George");
    emp1.setStreetName("State St."); 
        
    System.out.println("Changed emp1, new EMP 1 INFORMATION:");
    emp1.printEmpInfo(); //should print George's address...
    
    System.out.println("+++++++++++++++++++++++++++");
    //we have not changed emp3 in any way since it was created, right?
    System.out.println("did not change emp3, (OLD??) EMP 3 INFORMATION:");
    emp3.printEmpInfo(); //should still print Fred's Street name...
    

    
    //notice the names in emp1 and emp3 are still correct, but the addresses
    //got messed up.  
  }
}
