Creating "Copies" of objects 
Author Message
 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

Tue, 13 Jul 1999 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Creating a "MAPI.session" object

2. RDO "ActiveX cannot create object"???

3. Creating a "MAPI.session" object

4. Creating a "MAPI.session" object

5. Error "Cannot Create Object"

6. *"*-.,._,.-*"* I"LL TRADE VISUAL C++ FOR VBASIC *"*-.,_,.-*"*

7. detecting "object required" or null object

8. detecting "object required" or null object

9. "Keep updated copy" of task

10. Accessing shortcut "Copy Drawing" function programmatically

11. mshflexgrid "copy"

12. Turn off "Copy" function of page


Powered by phpBB® Forum Software