1
Answer

Dynamically creating objects

Morgan Hein

Morgan Hein

16y
2.9k
1
I know this is something that is common, but I just can't find a suitable answer anywhere on the internet. The keywords that I think pertain to my problem are not correct, so I can't figure out what to search for! Even someone linking me to a page about this would be helpful!

Let's say my program takes a text file (a story) as input, and I want to create an instance of the custom class "Person" for every person named in the text file. How do I do this? How can I dynamically create the objects, without knowing what the names are beforehand?

How can I later call those objects and their functions/variables w/o knowing the name of the object(s)?
Answers (1)