class - concept of simple c++ project with 2 classes for input and results of calculation -


is there give me basic ideas planning concept of c++ project?

i have gui 2 line-edits , button , result-field. ( later want have many line-edits input , result want keep simple) idea combine input-data in new class ( class input ) . result want combine result-data in class ( class result). calculating results want create method (something result sum ( input in ) ). don`t want of in 1 class, need input , result classes because have many data-fields in final version

would concept? if so, write method of calculation (sum()) ? in input class, result class or main.cpp ?

typically if have kind of input/output(or results) design, want third entity: evaluator/operator kind of thing feed in input , output result.

so if want flexibility, i'd @ 3 entities, not two:

  1. input encapsulate user input.
  2. evaluator/operator takes input , outputs result.
  3. result encapsulate computed result operator.

that'll give 3 separate entities: 1 focus on computation, , other 2 deal representing data.

this common nodal designs, so:

enter image description here

that's flexible design, suggests multiple relatively simple evaluators taking multiple simple inputs , outputs.

that might overkill in case if need 1 complex evaluator , 1 complex string input , output. i'd still stick 3-entity/interface separation less monolithic/fussy design , clear separation of responsibilities.


Comments