I have a problem with the concept of OOP when it comes to creating objects at runtime. All the educational code that I reviewed defines specific variables, for example. "Bob" and assigns them to a new instance of the object. Bob = Person ()
Now I am having trouble understanding how I will create a model that creates a new object at runtime? I know that my phrasing is probably wrong, since all objects are generated at runtime, but I mean that if I were to run the application in the terminal or user interface, how could I create new objects and manage them. Can't I define new variable names on the go?
An example application in which I ran into this design problem would be a database in which people are stored. The user receives a terminal menu that allows him to create a new user and assign a name, salary, position. How would you create an instance of this object and call it later if you want to manage it, call functions, etc.? What design template is here?
I apologize for my poor understanding of the OPP model. I am reading lessons and OOP right now, but I feel that I need to understand that my mistake is here before moving on. Please let me know if there is anything that I should clarify.
source
share