Context
I got some advice that with a particular data model, it would be best to use classes, not structs. Because using structs to store the data of a spreadsheet-like app I'm trying to make, will mean every change to any one cell, would cause the whole table data model to update at the same time, when it's not needed.
It sounds like using classes will prevent the app form inevitably crashing, bugging out, or just being supper laggy, as spreadsheets grow in size.
My problem now, is that every new instance of cell, row, and table section, needs to have its own data. Because "tile the plane with your word of choice" doesn't sound like a partially useful app. Something that needs to be avoided somehow, if I'm going to use classes, instead of structs.
The Problem
If the user hits the "Add Row"
button, and that just makes a new instance of a class cellRow
, then it will display the same stuff as all the other row instances.
This class behavior may be sidestepped by either:
- Making a new child class of
cellRow
, - Or just making a new class, declared in its entirely by an
addRow
function.
And everything in the table/organizer being in table sections and table supper sections - means there will have to be funcs that make new classes, that have arrays of classes inside them.
( Definitely should go with the child class option based on that, if I'm not mistaken. )
As a complete beginner in coding, I'm not entirely sure how to put together such a function, if this is a viable approach?
Any help would be greatly appreciated. Thanks!