10-05-2008, 08:00 PM
|
#1 (permalink)
|
|
The Acquainted
Join Date: Sep 2007
Location: Arizona
Posts: 114
Thanks: 10
|
Tying classes together
Well, I'm reading my OOP book right now, but it doesn't seem to help me TOO much when it comes to tying classes together.
Basically, say I have a user class, which requires access to a database. What would be the best method to access the DB class within the user class? I would guess to have the user class extend the database class, but it doesn't make perfect sense, and also what if I needed another class within it, such as a Validation class?
Is it really good practice to include other class files into one class, and then create an instance within the class itself? Wouldn't that fall victim to including files which in turn also include files, which I'm assuming isn't good practice?
Any insight would be great. This is really driving me nuts, as it's the only thing that's keeping me from starting my project (I don't want to start coding it, and then realize the entire structure is 'wrong').
|
|
|