Jump to content

sib

New Members
  • Posts

    2
  • Joined

  • Last visited

sib's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. sib

    Need guidance on OOP

    Hi Stefan, Many thanks for the suggestions, it is really appreciated. I understand now that stacking up classes is perhaps not the best way of doing things, so I've been doing some reading on interfaces, but not exactly sure how I would use this to relate two classes together using an interface. For example, I have two classes: the mysql_wrapper and a page class (which extends the wrapper and can access methods from it). How would I create an interface to do the same or achieve the same functionality? From what I have read, an interface is simply a blueprint to structure classes that implement the interface. Would this mean that in my interface I would have to lists all of the methods from the mysql_wrapper and all methods from the page class? If so, would this not create repetition amongst the different classes that implement this interface? Once again, if I have my wires crossed I sincerely apologise, but if you have any more information on how this can be accomplished, please let me know. Once again, thanks for your help and guidance. Sib.
  2. sib

    Need guidance on OOP

    Hi, First time poster and a bit of an OOP noob, so please go easy on me I need some advice and/or guidance on OOP. I am building a personal website at the moment and I have a mysql wrapper which is an abstract class containing common mysql scripts such as inserts/selects/deletes etc. I have then created another class which extends the mysql wrapper class and contains the same select/insert/delete methods calling them by using parent::method_name(). This child class will be used for all of the pages on the website which need to connect to a mysql db. To display the results from the query, another class is called which extends the above child class and contains methods specific to the page such as the html output from the query. So, in other words, the structure is: mysql_wrapper -> common_db -> page_class Apologies if I have not explained this clearly, but if you do know what I mean, would this be advisable?
×
×
  • Create New...