mercredi 19 décembre 2018

Correct way to design classes [on hold]

How should you design classes? Say for example you want to use a class to design a computer. My approach would be to store objects in the class: RAM, HARD DISK, CPU, MOTHERBOARD

Provide functions to build the computer:

OBTAIN MOTHERBAORD func

ADD HARD DISK to MOTHERBOARD func

ADD CPU to MOTHERBOARD func

ADD RAM to MOTHERBOARD func

Provide other functions the computer can do: PlAY MARIO KART func

Is there any problem with this approach? Is there any good class design practices one should follow?

Aucun commentaire:

Enregistrer un commentaire