
Creating "Copies" of objects
OK... there most certainly has to be a way to do this.
I am trying to create a copy of an object.
Here's a simplistic example.
If have a class called "Emp" which has
Public Name As String
Public Address As String
Here's the code I want to do.
Dim emp1 As New Emp
Dim emp2 As New Emp
emp1.Name = "Brian"
emp1.Address = "555 Elm St."
emp2 = emp1
^^^^^^^^^^^
emp1.Name = "Bill"
emp1.Address = "444 Elm St."
Msgbox emp2.Name & " " & emp2.Address 'Says Brian 555 Elm St.
Msgbox emp1.Name & " " & emp1.Address 'Says Bill 444 Elm St.
This is the part that I can't figure out. How do I use an assignment
operator to copy the values of the other object. I *DO NOT* want a
reference to the other object. After making the copy, if object1 changes I
*DON'T* want those changes reflected in object2 and vice versa.
I guess what I'm asking is there a way to assign whole objects properties,
the same way you do with user-defined types???
Any and all help is appreciated.
--
--------------------------------------------
Brian Orrell
Dallas, TX
fax: 214.522.1927