Jump to content

MySQL wrapper as a object var?


ohdang888

Recommended Posts

The first way is far superior.  Think about it:

 

Is the API a database?  Of course not.  It uses a database, but it isn't one itself.  Inheritance creates is-a relationships, where an object of a child class is an object of the parent class, with just a little bit extra.

 

Always favor composition (objects containing references to other objects) over inheritance.  Unless you're building a family of objects, inheritance will only set you back.

Link to comment
Share on other sites

The first way is far superior.  Think about it:

 

Is the API a database?  Of course not.  It uses a database, but it isn't one itself.  Inheritance creates is-a relationships, where an object of a child class is an object of the parent class, with just a little bit extra.

 

Always favor composition (objects containing references to other objects) over inheritance.  Unless you're building a family of objects, inheritance will only set you back.

 

great explanation. thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.