+ 1

Question for a personal “House” project. (Intermediate C++ Programmer)?

Hey, I have a Resident class that allows you to add / deduct allowance from residents who are classified as not adult and not mature (adult && mature = false). Each resident has a name, age, classification (bool adult, bool mature), and a balance. I want everyone to have their own individual account.. I thought about an array or vector, but I also thought about practicing class composition with this. Should I make the accounts themselves an entire class, or make functions based around “balance”? @ Sonic

12th May 2019, 11:53 PM
Seij Bailey
Seij Bailey - avatar
4 Réponses
+ 8
I think it is OK to make Account a separate class. What do you think ~ swim ~ ?
13th May 2019, 12:37 AM
Sonic
Sonic - avatar
+ 4
If in doubt, err on the side of too many classes.
13th May 2019, 1:40 AM
Schindlabua
Schindlabua - avatar
+ 2
On restrospect, I think I will make it a separate class, thanks for that Sonic
13th May 2019, 1:26 AM
Seij Bailey
Seij Bailey - avatar
0
If you have already resident class with all those properties why to make one more class for accounts.. In class Resident just put functions for add/remove balance.. And in main function save them to vector<resident> ? Sorry if missunderstood and wrote completely useless comment
13th May 2019, 6:16 PM
Nerminko Omanic
Nerminko Omanic - avatar