Results 1 to 3 of 3

Thread: How do I create a New copy of a Class

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2002
    Posts
    40

    How do I create a New copy of a Class

    Is there a way to create a new copy a class? For example, if myClass1 and myClass2 are Classes of the same Type and you set myClass2 = myClass1, then properties in myClass2 will change if properties in myClass1 change. I want it so that myClass2 is a new instance that is identical to myClass1.

    Thanks. Lance

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    It depends on the class, most classes should have a clone method that you can use:
    myClass2=myClass1.Clone

    If not you could serialize it or maybe there is another way.

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2002
    Posts
    40
    serialize sounds like an interesting idea. i'll look into it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width