Re: classes confusion



Henk Verhoeven wrote:
You can have inheritance as deep as you want. But to what use? Is there any other class you need to subclass from siteConfiguration? If not, why not put all of its content into dbConnection? The same goes for dbConnection itself: why not put everything into userSession?

Maybe you want to express the theoretical notion that these are different things? That's ok, but then why subclass them from another? To make them different things you need to make different objects. If these objects are related you may give one a reference to another, like in the example above. With the inheritance you are saying 'a dbConnection is a kind of siteConfiguration' and 'a userSession is a kind of dbCennection'. Is that really what you want to express?


Thanks for the pointers Henk. The reason why my 'siteConfig' class has to be separate, is because it contains more than settings for one database connection. It contains connection settings to two MySQL databases, an Access database, connection settings for active directory (LDAP), and more. I have to piece together a maintainable framework for an intranet, and many departments have their own way of storing data. Thus, I thought it would be logical to have a separate class that only deals with configuration settings.

If I understand you correctly, it might be better to just create an instance of this 'config' class inside methods of other classes, when config settings are required - as opposed to using the 'extends' keyword?

Thanks again,

Ed

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
.