class implementation problem
Posted: Thu Feb 17, 2005 8:35 am
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!!
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!!