5
I would like to create an object "mold" (maybe a class, maybe a function), with possibly other objects inside it, and arrays. The structure I imagine is like this:
postagem: {
titulo: "",
autor: "",
texto: [
{
linha: [{
caractere: '', // isso deveria ser um objeto
data: string, // objeto date?
}],
desfazer: ?, // objetos caractere/data
}
],
}
Explaining:
posting must contain: title, author and text; text shall contain an indefinite amount of: line and undo; line shall contain an indefinite amount of: date and character;
Is this crazy construction possible? How I would use that object?
The idea was to be able to transfer the instantiated objects this way from here to there using JSON.
Can you explain that part? "text must contain an undefined amount of: line and undo;"
– Paulo Sérgio Duff
@Paulosérgioduff text would be an array of "line" objects and "undo" objects, in my current conception
– Daniel
I edited the answer, making "line" an object.
– Mathiasfc
What are the variables you need to know to create the object and which are common?
– Sergio
@Sergio if I understood your question, there are no common variables - when instantiating, I imagined instantiating only with title and author - text with line/character/date would be added later, along the execution of the program
– Daniel