+ 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
4 Réponses
+ 8
I think it is OK to make Account a separate class. What do you think ~ swim ~ ?
+ 4
If in doubt, err on the side of too many classes.
+ 2
On restrospect, I think I will make it a separate class, thanks for that Sonic
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