Timeline for Constructing House using OOP
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 20, 2020 at 9:32 | comment | added | Martin Frank | @mtj excellent blog, and that points exactly to my question "what's the purpose" thank you for sharing this link!!! | |
May 18, 2020 at 10:09 | comment | added | mtj | Classes are usually created as a common denominator for things that have something in common. A room is a class, but a bedroom, bathroom, living room, etc. are not. They are instances of a room class. And this approach has the big advantage, that it does not limit the world to some artifical constraints. And now, I'll take my TV to the bathroom and watch some shows in the bathtub. (Excellent blog about this: ericlippert.com/2015/04/27/wizards-and-warriors-part-one) | |
May 18, 2020 at 6:22 | comment | added | Martin Frank | Could you give me the purpose of your Code - what do you want to achive with this Code? | |
May 17, 2020 at 17:28 | answer | added | Bobby | timeline score: 1 | |
May 17, 2020 at 15:25 | comment | added | Gilbert Le Blanc | No, that's not a good class either. Count the number of instances of Furniture where type equals sofa. Count the number of instances of Furniture where type equals chair. And o on. | |
May 17, 2020 at 13:57 | comment | added | Harsh Sengar | Are you suggesting this -> private Furniture furniture; //Furniture class public class Furniture{ private String sofaType; private String chairType; private String tableType; private int numOfSofa; private int numOfChair; private int numOfTable; } | |
May 17, 2020 at 12:43 | comment | added | Gilbert Le Blanc | It depends on what you're trying to model. I think a class for each type of furniture is possibly too deep. Assuming you're creating a room layout, I'd probably create a Furniture class that stores the size of the furniture piece and has a furniture type variable. That way, you can more easily add furniture types. | |
May 17, 2020 at 11:35 | review | First posts | |||
May 17, 2020 at 12:23 | |||||
May 17, 2020 at 11:31 | history | asked | Harsh Sengar | CC BY-SA 4.0 |