Showing results for 
Search instead for 
Did you mean: 

Conversion between ancestor and descendant classes


You class hierarchy seems reasonable although I don't really understand from the information you provided what are On-Disk File Format 2 Version 1.lvclass and On-Disk File Format 2 Version 2.lvclass but I guess these are the actual file formats and On-Disk File Format 2.lvclass is yet another abstraction layer.

So if I understood correctly you want to read a file of format A and write the content to a file of format B. There is not a single straight forward way of doing this. What you need to do to create the copy is to read the data from file A and then write it to file of format B. There is no shortcut.

One way you can do this is to create a dynamic dispatch method "Create new from" to each of your classes. The method would take another file as parameter and then create a new file based on the existing file. What this method however needs to actually do is to read one file and then write to another file. There are numerous alternatives and the proper choise depends really on your needs.

Tomi Maila
0 Kudos
Message 11 of 11