I am writing a project with two classes:
1 factory class and 1 "fragment" class.
The factory class creates fragments from a given input file. For example, if there was a file that was 100 bytes in size, the factory class would create 10 fragments of 10 bytes each.
The problem I am having is to dynamically create fragments from a class method. I need to create fragments such as:
f1, f2, f3 depending on the number of fragments created (which is not known at runtime).
This is being created as a module so once the factory class creates the fragment, I should be able to do certain things to certain fragments such as:
f1.get_data() which would get the character representation of the specific fragment.
How do I dynamically create fragments with names f1,f2,f3, etc based on the amount of fragments?