does anyone know how one class can use the methods and data of another class without using ingeritance??
for instance im creating a database that will store profile information on say employees of a company. there are 2 types of employees, staff and managers. i create one class for staff and one for managers. the managers class extends the staff class using inheritance. each class contains methods to get profile information, modify, update etc.
now i create a third class containing all the database code (sql code for example) for manipulating the databases tables. what id like to know is how exactly do i use this class in my staff and manager classes. For example the view profile method will require a method from the database opertations class to get data from a database table.
anyone have a solution to this??? any help will be much appreciated, thanks!!
class implementation problem
Moderator: General Moderators
-
dannymc1983
- Forum Commoner
- Posts: 80
- Joined: Wed Feb 16, 2005 7:24 am
-
dannymc1983
- Forum Commoner
- Posts: 80
- Joined: Wed Feb 16, 2005 7:24 am
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
Here's an overview:
http://www.phppatterns.com/index.php/ar ... iew/6/1/1/
http://www.phppatterns.com/index.php/ar ... iew/6/1/1/
-
dannymc1983
- Forum Commoner
- Posts: 80
- Joined: Wed Feb 16, 2005 7:24 am
-
dannymc1983
- Forum Commoner
- Posts: 80
- Joined: Wed Feb 16, 2005 7:24 am