>From OOP point of view.

Use encapsulation:
When a class has a "has-a" relation-ship with other class you should use
encapsulation. For example, If MyDB is a class that "has-a" pdo driver in
it, then PDO will be encapsulated inside MyDB class. This is also called
containment. MyDB should contain PDO.

Use inheritance:
When a class has a "is-a" relation ship with other class use inheritance.
For example,  Dog is an Animal. so Dog should extend Animal class. MyPHPDb
is-a PHP Database Object (aka PDO). So it'll be inheritance. MyPHPDb should
extend PDO.

Think about the relation have. Then implement it.


-- 
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader

Reply via email to