CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2004
    Posts
    23

    A way to make a copy of an object that doesn't have a copy constructor or clone()?

    I was wondering if there was a method or object that allows you to make a clone of a class or object that doesn't have the clone method.

    For example, say I have a 3rd party class called ThirdPartyImageClass

    except it doesn't define a copy constructor nor does it define a clone method

    I was wondering if there is a way to copy the object through reflection or sometype of underpinning of the dot framework.

    The reason why I ask is because the debugger in the local window can see all its hidden attributes (private and protected).

  2. #2
    Join Date
    Dec 2003
    Location
    http://map.search.ch/zuerich.en.html
    Posts
    1,074

    Re: A way to make a copy of an object that doesn't have a copy constructor or clone()?

    Hi Cipherous,

    I'm not aware of any automatic way of doing it.

    If you wanted you could do what the debugger is doing and use Reflection to get all the members of the object so that you can copy it.
    Useful? Then click on (Rate This Post) at the top of this post.

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

Featured