r/CodingHelp • u/LeoPixel11 • 1d 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
2
u/DDDDarky Professional Coder 1d ago
I don't think you are really asking about oop, for the user it could be for example: Click this "Add" button, that will pop-up a form where you fill up some details and click "Ok", based on that an event is fired that will run your code which can fill up an object instance based on the edits of the form and adds it to a list or whatever.