Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

To Clone Classes

Posted on 1999-06-21
8
Medium Priority
?
221 Views
Last Modified: 2013-11-23
Somebody Knows how clone classes without copying each property value from one to another?
I tried using Set command, but it only make a reference of my original class. I want to create a new class by copy from a previous one.

0
Comment
Question by:Marginal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 

Author Comment

by:Marginal
ID: 1518790
Edited text of question.
0
 

Author Comment

by:Marginal
ID: 1518791
Edited text of question.
0
 
LVL 15

Accepted Solution

by:
ameba earned 150 total points
ID: 1518792
Suggestion: Add Clone method to your object, so it will do everything.
See code
http://www.experts-exchange.com/Q.10153217
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:abm
ID: 1518793
I think there is a way to do this by making the class persistable in the class properties and then using the proprety bag object.
This is not very simple but once written would work for all classes. (As you say not like copying all the properties).
The use is explained in the VB manual under 'Persisting a Component's Data' and shows a sample of how to clone an object.
Hope this helps

0
 
LVL 15

Expert Comment

by:ameba
ID: 1518794
Yes there is a PropertyBag object in VB6, and there is a code in "Hardcore VB" to do this in VB5.
The main purpose of this object is saving properties to file (on hard disk). This method will work, but it is slow.
0
 

Author Comment

by:Marginal
ID: 1518795
Thanks a Lot!
0
 

Expert Comment

by:cpearson_mt
ID: 12888253
The  Accepted Answer link is broken, This is what I signed up for, what a rip.
0
 
LVL 15

Expert Comment

by:ameba
ID: 12890033
Hi cpearson_mt,
Links are a bit different now, use http:Q_10153217.html
Btw, there is better solution to this question, but you'll have to send me $10 first. Hahaha!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

662 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question