Working With Classes
I have been working with classes for a while now but I am not sure if I am using them correctly.
For example, let's say I have three classes. Main class, a receipt class and a database class. Main class is for all the logic, receipt class stores functions for create_receipt, print_receipt,etc. Database class is for querying the database.
So in main class I call create_receipt function from the receipt class. Inside of that function I might call something from the database class such as retrieve_items. Should I be doing that or should I always go back to the main class? Is it acceptable to call other classes from within classes and if so, should I be using the class create from Main or create a new instance of the class?
I find myself creating classes all over the place which doesn't seem logical.
Submitted July 09, 2017 at 10:37PM by jerim79
via reddit http://ift.tt/2u7PTkh