Inventory Class Implementation

Aug 20, 2009 at 6:25am
Ok: I am using polymorphism and inheritance to create an inventory tracking program. My issue is that I don't understand how to read a user input into a class. For example, my base class (and all derived ones) need the user to input 3 different parameters.

Do I ask the user to input information in the main function, or in the definitions of my get functions?
Aug 20, 2009 at 7:02am
show some code?
Aug 20, 2009 at 12:04pm
The standard answer, I think, would be to do it outside the classes. You should always try to separate user interface code from "work code". Why? Because you may wake up some day and say "This UI sucks!! I want a new one."

Even if you don't say it, somebody will say it. When that happens, you'll be glad you are able to copy your classes from one project to another without any modification. Always try to think in self-sustainable modules with clear objectives.
Topic archived. No new replies allowed.