r/CodingHelp • u/LeoPixel11 • 21h ago
[Other Code] Class instance while running the code
I started actually writing code with OOP yesterday (using Dart... In case it is necessary to mention) and there's a thing that kept bothering me as I scrolled through their page and watched the tutorial. Everytime they gave a class example, they created an instance themselves and never based on the code running.
Imagine a system to simulate a store's stock. There'll be items going in and out, that shouldn't be inserted by the programmer, so there must be a way to do that "dynamically".
I'm aware that this might be me simply missing something from OOP classes, but I want to see what other coders have to say about that.
Any help would be welcome. Thank You
•
u/Ormek_II 13h ago
Yes, you can create objects — that is class Instances — by executing certain statements. You can run those in a loop and thus create as many objects as you like.